From d52b57a8922565805163762edb7c375de062cec9 Mon Sep 17 00:00:00 2001 From: ziyi chen Date: Mon, 16 Oct 2023 10:03:30 -0400 Subject: [PATCH] Rename length() to size() --- src/function/built_in_vector_functions.cpp | 5 +- src/function/vector_list_functions.cpp | 16 ++-- src/function/vector_string_functions.cpp | 9 -- src/include/common/expression_type.h | 2 +- .../list/functions/list_len_function.h | 25 +++++- .../function/list/vector_list_functions.h | 2 +- .../string/functions/array_extract_function.h | 4 +- .../string/functions/left_operation.h | 4 +- .../string/functions/length_function.h | 35 -------- .../string/functions/right_function.h | 4 +- .../function/string/vector_string_functions.h | 4 - test/test_files/tinysnb/exception/list.test | 2 +- test/test_files/tinysnb/function/case.test | 2 +- test/test_files/tinysnb/function/list.test | 84 +++++++++++-------- test/test_files/tinysnb/function/string.test | 57 +++++++------ test/test_files/tinysnb/path/path.test | 17 ++-- .../tinysnb/var_length_extend/n_n.test | 2 +- 17 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 src/include/function/string/functions/length_function.h diff --git a/src/function/built_in_vector_functions.cpp b/src/function/built_in_vector_functions.cpp index b8eb18b446..c68d86edd8 100644 --- a/src/function/built_in_vector_functions.cpp +++ b/src/function/built_in_vector_functions.cpp @@ -447,7 +447,6 @@ void BuiltInVectorFunctions::registerStringFunctions() { vectorFunctions.insert({ENDS_WITH_FUNC_NAME, EndsWithVectorFunction::getDefinitions()}); vectorFunctions.insert({LCASE_FUNC_NAME, LowerVectorFunction::getDefinitions()}); vectorFunctions.insert({LEFT_FUNC_NAME, LeftVectorFunction::getDefinitions()}); - vectorFunctions.insert({LENGTH_FUNC_NAME, LengthVectorFunction::getDefinitions()}); vectorFunctions.insert({LOWER_FUNC_NAME, LowerVectorFunction::getDefinitions()}); vectorFunctions.insert({LPAD_FUNC_NAME, LpadVectorFunction::getDefinitions()}); vectorFunctions.insert({LTRIM_FUNC_NAME, LtrimVectorFunction::getDefinitions()}); @@ -512,7 +511,7 @@ void BuiltInVectorFunctions::registerCastFunctions() { void BuiltInVectorFunctions::registerListFunctions() { vectorFunctions.insert({LIST_CREATION_FUNC_NAME, ListCreationVectorFunction::getDefinitions()}); vectorFunctions.insert({LIST_RANGE_FUNC_NAME, ListRangeVectorFunction::getDefinitions()}); - vectorFunctions.insert({LIST_LEN_FUNC_NAME, ListLenVectorFunction::getDefinitions()}); + vectorFunctions.insert({SIZE_FUNC_NAME, SizeVectorFunction::getDefinitions()}); vectorFunctions.insert({LIST_EXTRACT_FUNC_NAME, ListExtractVectorFunction::getDefinitions()}); vectorFunctions.insert({LIST_ELEMENT_FUNC_NAME, ListExtractVectorFunction::getDefinitions()}); vectorFunctions.insert({LIST_CONCAT_FUNC_NAME, ListConcatVectorFunction::getDefinitions()}); @@ -559,7 +558,7 @@ void BuiltInVectorFunctions::registerMapFunctions() { vectorFunctions.insert({MAP_CREATION_FUNC_NAME, MapCreationVectorFunctions::getDefinitions()}); vectorFunctions.insert({MAP_EXTRACT_FUNC_NAME, MapExtractVectorFunctions::getDefinitions()}); vectorFunctions.insert({ELEMENT_AT_FUNC_NAME, MapExtractVectorFunctions::getDefinitions()}); - vectorFunctions.insert({CARDINALITY_FUNC_NAME, ListLenVectorFunction::getDefinitions()}); + vectorFunctions.insert({CARDINALITY_FUNC_NAME, SizeVectorFunction::getDefinitions()}); vectorFunctions.insert({MAP_KEYS_FUNC_NAME, MapKeysVectorFunctions::getDefinitions()}); vectorFunctions.insert({MAP_VALUES_FUNC_NAME, MapValuesVectorFunctions::getDefinitions()}); } diff --git a/src/function/vector_list_functions.cpp b/src/function/vector_list_functions.cpp index fe339601c2..fff5fa6e58 100644 --- a/src/function/vector_list_functions.cpp +++ b/src/function/vector_list_functions.cpp @@ -122,15 +122,17 @@ vector_function_definitions ListRangeVectorFunction::getDefinitions() { return result; } -vector_function_definitions ListLenVectorFunction::getDefinitions() { +vector_function_definitions SizeVectorFunction::getDefinitions() { vector_function_definitions result; - auto execFunc = UnaryExecFunction; - result.push_back(std::make_unique(LIST_LEN_FUNC_NAME, - std::vector{LogicalTypeID::VAR_LIST}, LogicalTypeID::INT64, execFunc, - true /* isVarlength*/)); + result.push_back(std::make_unique(SIZE_FUNC_NAME, + std::vector{LogicalTypeID::VAR_LIST}, LogicalTypeID::INT64, + UnaryExecFunction, true /* isVarlength*/)); result.push_back(std::make_unique(CARDINALITY_FUNC_NAME, - std::vector{LogicalTypeID::MAP}, LogicalTypeID::INT64, execFunc, - true /* isVarlength*/)); + std::vector{LogicalTypeID::MAP}, LogicalTypeID::INT64, + UnaryExecFunction, true /* isVarlength*/)); + result.push_back(std::make_unique(SIZE_FUNC_NAME, + std::vector{LogicalTypeID::STRING}, LogicalTypeID::INT64, + UnaryExecFunction, true /* isVarlength*/)); return result; } diff --git a/src/function/vector_string_functions.cpp b/src/function/vector_string_functions.cpp index 08154f48da..0682a42dc5 100644 --- a/src/function/vector_string_functions.cpp +++ b/src/function/vector_string_functions.cpp @@ -5,7 +5,6 @@ #include "function/string/functions/contains_function.h" #include "function/string/functions/ends_with_function.h" #include "function/string/functions/left_operation.h" -#include "function/string/functions/length_function.h" #include "function/string/functions/lpad_function.h" #include "function/string/functions/regexp_extract_all_function.h" #include "function/string/functions/regexp_extract_function.h" @@ -168,14 +167,6 @@ vector_function_definitions LeftVectorFunction::getDefinitions() { return definitions; } -vector_function_definitions LengthVectorFunction::getDefinitions() { - vector_function_definitions definitions; - definitions.emplace_back(make_unique(LENGTH_FUNC_NAME, - std::vector{LogicalTypeID::STRING}, LogicalTypeID::INT64, - UnaryExecFunction, false /* isVarLength */)); - return definitions; -} - vector_function_definitions LpadVectorFunction::getDefinitions() { vector_function_definitions definitions; definitions.emplace_back(make_unique(LPAD_FUNC_NAME, diff --git a/src/include/common/expression_type.h b/src/include/common/expression_type.h index 52c03d50c9..dcd6d53023 100644 --- a/src/include/common/expression_type.h +++ b/src/include/common/expression_type.h @@ -47,7 +47,6 @@ const std::string LIST_CREATION_FUNC_NAME = "LIST_CREATION"; const std::string LIST_RANGE_FUNC_NAME = "RANGE"; const std::string LIST_EXTRACT_FUNC_NAME = "LIST_EXTRACT"; const std::string LIST_ELEMENT_FUNC_NAME = "LIST_ELEMENT"; -const std::string LIST_LEN_FUNC_NAME = "LEN"; const std::string LIST_CONCAT_FUNC_NAME = "LIST_CONCAT"; const std::string LIST_CAT_FUNC_NAME = "LIST_CAT"; const std::string ARRAY_CONCAT_FUNC_NAME = "ARRAY_CONCAT"; @@ -174,6 +173,7 @@ const std::string REGEXP_MATCHES_FUNC_NAME = "REGEXP_MATCHES"; const std::string REGEXP_REPLACE_FUNC_NAME = "REGEXP_REPLACE"; const std::string REGEXP_EXTRACT_FUNC_NAME = "REGEXP_EXTRACT"; const std::string REGEXP_EXTRACT_ALL_FUNC_NAME = "REGEXP_EXTRACT_ALL"; +const std::string SIZE_FUNC_NAME = "SIZE"; // Date functions. const std::string DATE_PART_FUNC_NAME = "DATE_PART"; diff --git a/src/include/function/list/functions/list_len_function.h b/src/include/function/list/functions/list_len_function.h index 9b11a6d245..b0d4e40c65 100644 --- a/src/include/function/list/functions/list_len_function.h +++ b/src/include/function/list/functions/list_len_function.h @@ -4,16 +4,39 @@ #include #include "common/types/ku_list.h" +#include "utf8proc.h" namespace kuzu { namespace function { struct ListLen { public: - static inline void operation(common::list_entry_t& input, int64_t& result) { + template + static inline void operation(T& input, int64_t& result) { result = input.size; } }; +template<> +inline void ListLen::operation(common::ku_string_t& input, int64_t& result) { + auto totalByteLength = input.len; + auto inputString = input.getAsString(); + for (auto i = 0; i < totalByteLength; i++) { + if (inputString[i] & 0x80) { + int64_t length = 0; + // Use grapheme iterator to identify bytes of utf8 char and increment once for each + // char. + utf8proc::utf8proc_grapheme_callback( + inputString.c_str(), totalByteLength, [&](size_t start, size_t end) { + length++; + return true; + }); + result = length; + return; + } + } + result = totalByteLength; +} + } // namespace function } // namespace kuzu diff --git a/src/include/function/list/vector_list_functions.h b/src/include/function/list/vector_list_functions.h index c26d7c8770..4a994f8e0f 100644 --- a/src/include/function/list/vector_list_functions.h +++ b/src/include/function/list/vector_list_functions.h @@ -203,7 +203,7 @@ struct ListRangeVectorFunction : public VectorListFunction { const binder::expression_vector& arguments, FunctionDefinition* definition); }; -struct ListLenVectorFunction : public VectorListFunction { +struct SizeVectorFunction : public VectorListFunction { static vector_function_definitions getDefinitions(); }; diff --git a/src/include/function/string/functions/array_extract_function.h b/src/include/function/string/functions/array_extract_function.h index 79172bca96..cbb940d9bc 100644 --- a/src/include/function/string/functions/array_extract_function.h +++ b/src/include/function/string/functions/array_extract_function.h @@ -4,7 +4,7 @@ #include #include "common/types/ku_string.h" -#include "length_function.h" +#include "function/list/functions/list_len_function.h" #include "substr_function.h" namespace kuzu { @@ -19,7 +19,7 @@ struct ArrayExtract { } auto stringVal = str.getAsString(); int64_t strLen; - Length::operation(str, strLen); + ListLen::operation(str, strLen); auto idxPos = idx > 0 ? std::min(idx, strLen) : std::max(strLen + idx, (int64_t)0) + 1; auto startPos = idxPos - 1; auto endPos = startPos + 1; diff --git a/src/include/function/string/functions/left_operation.h b/src/include/function/string/functions/left_operation.h index 018b89867a..8faa4cf367 100644 --- a/src/include/function/string/functions/left_operation.h +++ b/src/include/function/string/functions/left_operation.h @@ -4,7 +4,7 @@ #include #include "common/types/ku_string.h" -#include "length_function.h" +#include "function/list/functions/list_len_function.h" #include "substr_function.h" namespace kuzu { @@ -15,7 +15,7 @@ struct Left { static inline void operation(common::ku_string_t& left, int64_t& right, common::ku_string_t& result, common::ValueVector& resultValueVector) { int64_t leftLen; - Length::operation(left, leftLen); + ListLen::operation(left, leftLen); int64_t len = (right > -1) ? std::min(leftLen, right) : std::max(leftLen + right, (int64_t)0); SubStr::operation(left, 1, len, result, resultValueVector); diff --git a/src/include/function/string/functions/length_function.h b/src/include/function/string/functions/length_function.h deleted file mode 100644 index 6d3849a7ee..0000000000 --- a/src/include/function/string/functions/length_function.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include - -#include "common/types/ku_string.h" -#include "utf8proc.h" - -namespace kuzu { -namespace function { - -struct Length { - static inline void operation(common::ku_string_t& input, int64_t& result) { - auto totalByteLength = input.len; - auto inputString = input.getAsString(); - for (auto i = 0; i < totalByteLength; i++) { - if (inputString[i] & 0x80) { - int64_t length = 0; - // Use grapheme iterator to identify bytes of utf8 char and increment once for each - // char. - utf8proc::utf8proc_grapheme_callback( - inputString.c_str(), totalByteLength, [&](size_t start, size_t end) { - length++; - return true; - }); - result = length; - return; - } - } - result = totalByteLength; - } -}; - -} // namespace function -} // namespace kuzu diff --git a/src/include/function/string/functions/right_function.h b/src/include/function/string/functions/right_function.h index 535afcbd1c..7c2b65198a 100644 --- a/src/include/function/string/functions/right_function.h +++ b/src/include/function/string/functions/right_function.h @@ -4,7 +4,7 @@ #include #include "common/types/ku_string.h" -#include "length_function.h" +#include "function/list/functions/list_len_function.h" #include "substr_function.h" namespace kuzu { @@ -15,7 +15,7 @@ struct Right { static inline void operation(common::ku_string_t& left, int64_t& right, common::ku_string_t& result, common::ValueVector& resultValueVector) { int64_t leftLen; - Length::operation(left, leftLen); + ListLen::operation(left, leftLen); int64_t len = (right > -1) ? std::min(leftLen, right) : std::max(leftLen + right, (int64_t)0); SubStr::operation(left, leftLen - len + 1, len, result, resultValueVector); diff --git a/src/include/function/string/vector_string_functions.h b/src/include/function/string/vector_string_functions.h index a6d789d880..4385b70b62 100644 --- a/src/include/function/string/vector_string_functions.h +++ b/src/include/function/string/vector_string_functions.h @@ -71,10 +71,6 @@ struct LeftVectorFunction : public VectorStringFunction { static vector_function_definitions getDefinitions(); }; -struct LengthVectorFunction : public VectorStringFunction { - static vector_function_definitions getDefinitions(); -}; - struct LowerVectorFunction : public VectorStringFunction { static inline vector_function_definitions getDefinitions() { return getUnaryStrFunctionDefintion(common::LOWER_FUNC_NAME); diff --git a/test/test_files/tinysnb/exception/list.test b/test/test_files/tinysnb/exception/list.test index 4cd8be7740..3c97e46883 100644 --- a/test/test_files/tinysnb/exception/list.test +++ b/test/test_files/tinysnb/exception/list.test @@ -25,6 +25,6 @@ Binder exception: Cannot bind LIST_CONCAT with parameter type INT64[] and STRING Binder exception: Cannot bind LIST_CREATION with parameter type INT64 and STRING. -CASE ListPrepareError --STATEMENT MATCH (a:person) RETURN len($1) +-STATEMENT MATCH (a:person) RETURN size($1) ---- error Binder exception: Cannot resolve recursive data type for expression $1. diff --git a/test/test_files/tinysnb/function/case.test b/test/test_files/tinysnb/function/case.test index 00cd049020..8c2c40ab4c 100644 --- a/test/test_files/tinysnb/function/case.test +++ b/test/test_files/tinysnb/function/case.test @@ -30,7 +30,7 @@ Hubert Blaine Wolfeschlegelsteinhausenbergerdorff 7.100000 -LOG CaseListTest --STATEMENT MATCH (a:person) WHERE a.ID > 6 RETURN CASE WHEN len(a.workedHours) = 1 THEN a.courseScoresPerTerm END +-STATEMENT MATCH (a:person) WHERE a.ID > 6 RETURN CASE WHEN size(a.workedHours) = 1 THEN a.courseScoresPerTerm END ---- 4 diff --git a/test/test_files/tinysnb/function/list.test b/test/test_files/tinysnb/function/list.test index cc56a0c12c..d56b7c95df 100644 --- a/test/test_files/tinysnb/function/list.test +++ b/test/test_files/tinysnb/function/list.test @@ -42,7 +42,7 @@ Binder exception: Cannot bind LIST_CREATION with parameter type STRING and INT64 ---- error Binder exception: Cannot bind LIST_CREATION with parameter type INT64[] and STRING[]. --LOG NodeLISTStructuredPropertiesTest +-LOG NodeLISTPropertiesTest -STATEMENT MATCH (a:person) RETURN a.workedHours, a.usedNames, a.courseScoresPerTerm ---- 8 [1,9]|[Wolfeschlegelstein,Daniel]|[[7,4],[8,8],[9]] @@ -241,7 +241,7 @@ False 10 years 5 months 13:00:00.000024 3 years 2 days 13:02:00 --LOG ListExtractStructuredListOfListOfInts +-LOG ListExtractListOfListOfInts -STATEMENT MATCH (a:person) RETURN list_element(a.courseScoresPerTerm, 1) ---- 8 [10,8] @@ -253,7 +253,7 @@ False [10] [7] --LOG ListExtractStructuredList +-LOG ListExtractList -STATEMENT MATCH (a:person) RETURN a.usedNames[1] ---- 8 Aida @@ -306,8 +306,8 @@ ad ---- 1 是一个中 --LOG ListLenStructuredListOfInts --STATEMENT MATCH (a:person) RETURN len(a.workedHours) +-LOG ListLenListOfInts +-STATEMENT MATCH (a:person) RETURN size(a.workedHours) ---- 8 2 2 @@ -318,7 +318,19 @@ ad 1 8 --LOG ListConcatStructuredListOfInts +-LOG ListSize +-STATEMENT MATCH (a:person) RETURN size(a.courseScoresPerTerm) +---- 8 +2 +2 +1 +3 +3 +1 +1 +3 + +-LOG ListConcatListOfInts -STATEMENT MATCH (a:person) RETURN list_concat(a.workedHours, [a.age, a.gender]) ---- 8 [10,5,35,1] @@ -342,7 +354,7 @@ ad [1,3] [10,11,12,3,4,5,6,7,3] --LOG ListConcatStructuredListOfStrings +-LOG ListConcatListOfStrings -STATEMENT MATCH (a:person) RETURN array_concat(a.usedNames, [a.fName]) ---- 8 [Aida,Alice] @@ -354,7 +366,7 @@ ad [Grad,Greg] [Ad,De,Hi,Kye,Orlan,Hubert Blaine Wolfeschlegelsteinhausenbergerdorff] --LOG ListConcatStructuredListOfListOfInts +-LOG ListConcatListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_cat(a.courseScoresPerTerm, [[a.age, a.age], [a.gender]]) ---- 8 [[10,8],[6,7,8],[35,35],[1]] @@ -474,7 +486,7 @@ ad [1.600000,1.600000] [1.323000,1.323000] --LOG ListAppendStructuredListOfStrings +-LOG ListAppendListOfStrings -STATEMENT MATCH (a:person) RETURN array_append(a.usedNames, a.fName) ---- 8 [Aida,Alice] @@ -486,7 +498,7 @@ ad [Grad,Greg] [Ad,De,Hi,Kye,Orlan,Hubert Blaine Wolfeschlegelsteinhausenbergerdorff] --LOG ListAppendStructuredListOfListOfInts +-LOG ListAppendListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_push_back(a.courseScoresPerTerm, [a.age, a.age]) ---- 8 [[10,8],[6,7,8],[35,35]] @@ -498,7 +510,7 @@ ad [[10],[40,40]] [[7],[10],[6,7],[83,83]] --LOG ListAppendStructuredListOfBools +-LOG ListAppendListOfBools -STATEMENT MATCH (a:person) RETURN list_append([a.isStudent, a.isWorker], a.isStudent) ---- 8 [True,False,True] @@ -510,7 +522,7 @@ ad [False,False,False] [False,True,False] --LOG ListAppendStructuredListOfDoubles +-LOG ListAppendListOfDoubles -STATEMENT MATCH (a:person) RETURN list_append([a.eyeSight], a.eyeSight) ---- 8 [5.000000,5.000000] @@ -522,7 +534,7 @@ ad [4.900000,4.900000] [4.900000,4.900000] --LOG ListAppendStructuredListOfDates +-LOG ListAppendListOfDates -STATEMENT MATCH (a:person) RETURN list_append([a.birthdate], a.birthdate) ---- 8 [1900-01-01,1900-01-01] @@ -534,7 +546,7 @@ ad [1980-10-26,1980-10-26] [1990-11-27,1990-11-27] --LOG ListAppendStructuredListOfTimestamps +-LOG ListAppendListOfTimestamps -STATEMENT MATCH (a:person) RETURN list_append([a.registerTime], a.registerTime) ---- 8 [2011-08-20 11:25:30,2011-08-20 11:25:30] @@ -546,7 +558,7 @@ ad [1976-12-23 04:41:42,1976-12-23 04:41:42] [2023-02-21 13:25:30,2023-02-21 13:25:30] --LOG ListAppendStructuredListOfIntervals +-LOG ListAppendListOfIntervals -STATEMENT MATCH (a:person) RETURN list_append([a.lastJobDuration], a.lastJobDuration) ---- 8 [3 years 2 days 13:02:00,3 years 2 days 13:02:00] @@ -644,7 +656,7 @@ ad [1.600000,1.600000] [1.323000,1.323000] --LOG ListPrependStructuredListOfStrings +-LOG ListPrependListOfStrings -STATEMENT MATCH (a:person) RETURN array_prepend(a.usedNames, a.fName) ---- 8 [Alice,Aida] @@ -656,7 +668,7 @@ ad [Greg,Grad] [Hubert Blaine Wolfeschlegelsteinhausenbergerdorff,Ad,De,Hi,Kye,Orlan] --LOG ListPrependStructuredListOfBools +-LOG ListPrependListOfBools -STATEMENT MATCH (a:person) RETURN list_prepend([a.isStudent, a.isWorker], a.isStudent) ---- 8 [True,True,False] @@ -668,7 +680,7 @@ ad [False,False,False] [False,False,True] --LOG ListPrependStructuredListOfDoubles +-LOG ListPrependListOfDoubles -STATEMENT MATCH (a:person) RETURN list_prepend([a.eyeSight], a.eyeSight) ---- 8 [5.000000,5.000000] @@ -680,7 +692,7 @@ ad [4.900000,4.900000] [4.900000,4.900000] --LOG ListPrependStructuredListOfDates +-LOG ListPrependListOfDates -STATEMENT MATCH (a:person) RETURN list_prepend([a.birthdate], a.birthdate) ---- 8 [1900-01-01,1900-01-01] @@ -692,7 +704,7 @@ ad [1980-10-26,1980-10-26] [1990-11-27,1990-11-27] --LOG ListPrependStructuredListOfTimestamps +-LOG ListPrependListOfTimestamps -STATEMENT MATCH (a:person) RETURN list_prepend([a.registerTime], a.registerTime) ---- 8 [2011-08-20 11:25:30,2011-08-20 11:25:30] @@ -704,7 +716,7 @@ ad [1976-12-23 04:41:42,1976-12-23 04:41:42] [2023-02-21 13:25:30,2023-02-21 13:25:30] --LOG ListPrependStructuredListOfIntervals +-LOG ListPrependListOfIntervals -STATEMENT MATCH (a:person) RETURN list_prepend([a.lastJobDuration], a.lastJobDuration) ---- 8 [3 years 2 days 13:02:00,3 years 2 days 13:02:00] @@ -716,7 +728,7 @@ ad [10 years 5 months 13:00:00.000024,10 years 5 months 13:00:00.000024] [3 years 2 days 13:02:00,3 years 2 days 13:02:00] --LOG ListPrependStructuredListOfListOfInts +-LOG ListPrependListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_push_front(a.courseScoresPerTerm, [a.age, a.age]) ---- 8 [[35,35],[10,8],[6,7,8]] @@ -740,7 +752,7 @@ ad [0:6,0:6] [0:7,0:7] --LOG ListPositionStructuredListOfInts +-LOG ListPositionListOfInts -STATEMENT MATCH (a:person) RETURN list_position(a.workedHours, 5) ---- 8 2 @@ -752,7 +764,7 @@ ad 0 6 --LOG ListPositionStructuredListOfStrings +-LOG ListPositionListOfStrings -STATEMENT MATCH (a:person) RETURN array_position(a.usedNames, "Grad") ---- 8 0 @@ -771,7 +783,7 @@ ad 2 4 --LOG ListPositionStructuredListOfListOfInts +-LOG ListPositionListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_indexof(a.courseScoresPerTerm, [8]) ---- 8 0 @@ -879,7 +891,7 @@ ad 0 0 --LOG ListContainsStructuredListOfInts +-LOG ListContainsListOfInts -STATEMENT MATCH (a:person) RETURN list_contains(a.workedHours, 5) ---- 8 True @@ -897,7 +909,7 @@ True 7 8 --LOG ListContainsStructuredListOfStrings +-LOG ListContainsListOfStrings -STATEMENT MATCH (a:person) RETURN list_has(a.usedNames, "Grad") ---- 8 False @@ -909,7 +921,7 @@ False True False --LOG ListContainsStructuredListOfListOfInts +-LOG ListContainsListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_contains(a.courseScoresPerTerm, [8]) ---- 8 False @@ -935,7 +947,7 @@ True [7,9,10,20] [7,9,10,20,15,192] --LOG ListSliceStructuredListOfInts +-LOG ListSliceListOfInts -STATEMENT MATCH (a:person) RETURN list_slice(a.workedHours, 1, 2) ---- 8 [10] @@ -947,7 +959,7 @@ True [1] [10] --LOG ListSliceStructuredListOfListOfInts +-LOG ListSliceListOfListOfInts -STATEMENT MATCH (a:person) RETURN array_slice(a.usedNames, 1, 2) ---- 8 [Aida] @@ -959,7 +971,7 @@ True [Grad] [Ad] --LOG ListSliceStructuredListOfStrings +-LOG ListSliceListOfStrings -STATEMENT MATCH (a:person) RETURN list_slice(a.courseScoresPerTerm, 1, 2) ---- 8 [[10,8]] @@ -971,14 +983,14 @@ True [[10]] [[7]] --LOG ListSliceStructuredString +-LOG ListSliceString -STATEMENT MATCH (o:organisation) RETURN o.name[1:4] ---- 3 ABFs CsWo DEsW --LOG ListSliceStructuredStringRight +-LOG ListSliceStringRight -STATEMENT MATCH (a:person) RETURN a.fName[4:] ---- 8 ce @@ -990,7 +1002,7 @@ ooq g ert Blaine Wolfeschlegelsteinhausenbergerdorff --LOG ListSliceStructuredStringLeft +-LOG ListSliceStringLeft -STATEMENT MATCH (a:person) RETURN a.fName[:5] ---- 8 Alice @@ -1002,14 +1014,14 @@ Faroo Greg Huber --LOG ListSliceStructuredStringNull +-LOG ListSliceStringNull -STATEMENT MATCH (o:organisation) RETURN o.name[:] ---- 3 ABFsUni CsWork DEsWork --LOG ListSliceStructuredStringDoubleSlice +-LOG ListSliceStringDoubleSlice -STATEMENT MATCH (a:person) RETURN a.fName[3:][2:4] ---- 8 ce diff --git a/test/test_files/tinysnb/function/string.test b/test/test_files/tinysnb/function/string.test index 2f55c2d3ed..2e1a0b8908 100644 --- a/test/test_files/tinysnb/function/string.test +++ b/test/test_files/tinysnb/function/string.test @@ -90,12 +90,12 @@ ---- 1 1 --LOG DateVarAndStrVarConcatStructured +-LOG DateVarAndStrVarConcat -STATEMENT MATCH (a:person) WHERE '1900-01-01Alice' = concat(string(a.birthdate), a.fName) RETURN COUNT(*) ---- 1 1 --LOG TimestampVarAndStrVarConcatStructured +-LOG TimestampVarAndStrVarConcat -STATEMENT MATCH (a:person) WHERE '2011-08-20 11:25:30Alice' = concat(string(a.registerTime), a.fName) RETURN COUNT(*) ---- 1 1 @@ -151,7 +151,7 @@ False ---- 1 Carol --LOG LowerStructuredStr +-LOG LowerStr -STATEMENT MATCH (o:organisation) RETURN lower(o.name) ---- 3 abfsuni @@ -165,7 +165,7 @@ sóló cón tu párejâ the 😂😃🧘🏻‍♂️🌍🌦️🍞🚗 movie roma --LOG UpperStructuredStr +-LOG UpperStr -STATEMENT MATCH (o:organisation) RETURN upper(o.name) ---- 3 ABFSUNI @@ -179,28 +179,28 @@ SÓLÓ CÓN TU PÁREJÂ THE 😂😃🧘🏻‍♂️🌍🌦️🍞🚗 MOVIE ROMA --LOG TrimStructuredStr +-LOG TrimStr -STATEMENT MATCH (o:organisation) RETURN trim(o.name) ---- 3 ABFsUni CsWork DEsWork --LOG LtrimStructuredStr +-LOG LtrimStr -STATEMENT MATCH (o:organisation) RETURN ltrim(o.name) ---- 3 ABFsUni CsWork DEsWork --LOG RtrimStructuredStr +-LOG RtrimStr -STATEMENT MATCH (o:organisation) RETURN rtrim(o.name) ---- 3 ABFsUni CsWork DEsWork --LOG ReverseStructuredStr +-LOG ReverseStr -STATEMENT MATCH (o:organisation) RETURN reverse(o.name) ---- 3 inUsFBA @@ -214,21 +214,28 @@ kroWsED eivom 🚗🍞🌦️🌍🧘🏻‍♂️😃😂 ehT amoR --LOG LengthStructuredStr --STATEMENT MATCH (o:organisation) RETURN length(o.name) +-LOG LengthStr +-STATEMENT MATCH (o:organisation) RETURN size(o.name) ---- 3 7 6 7 --LOG RepeatStructuredStr +-LOG SizeStr +-STATEMENT MATCH (:person)-[s:studyAt]->(:organisation) RETURN size(s.places[1]) +---- 3 +13 +14 +4 + +-LOG RepeatStr -STATEMENT MATCH (o:organisation) RETURN repeat(o.name, o.ID) ---- 3 ABFsUni CsWorkCsWorkCsWorkCsWork DEsWorkDEsWorkDEsWorkDEsWorkDEsWorkDEsWork --LOG LpadStructuredStrAndLiteralInt +-LOG LpadStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN lpad(p.fName, 5, "<") ---- 8 Alice @@ -266,7 +273,7 @@ Huber --LOG RpadStructuredStrAndLiteralInt +-LOG RpadStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN rpad(p.fName, 15, ">") ---- 8 Alice>>>>>>>>>> @@ -292,7 +299,7 @@ Romaâó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞 --LOG RpadStructuredStrAndStructuredInt +-LOG RpadStrAndInt -STATEMENT MATCH (p:person) RETURN rpad(p.fName, p.ID, "<") ---- 8 @@ -311,7 +318,7 @@ Hubert Bla --LOG SubStrStructuredStrAndLiteralInt +-LOG SubStrStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN substr(p.fName, 2, 12) ---- 8 lice @@ -323,7 +330,7 @@ arooq reg ubert Blaine --LOG LeftPositiveIdxStructuredStrAndLiteralInt +-LOG LeftPositiveIdxStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN left(p.fName, 11) ---- 8 Alice @@ -342,14 +349,14 @@ Sóló c The 😂😃 Roma --LOG LeftPositiveIdxStructuredStrAndStructuredInt +-LOG LeftPositiveIdxStrAndInt -STATEMENT MATCH (o:organisation) RETURN left(o.name, o.ID) ---- 3 A CsWo DEsWor --LOG LeftNegativeIdxStructuredStrAndLiteralInt +-LOG LeftNegativeIdxStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN left(p.fName, -4) ---- 8 A @@ -367,7 +374,7 @@ Hubert Blaine Wolfeschlegelsteinhausenbergerd Sóló cón tu The 😂😃🧘🏻‍♂️🌍🌦️🍞 --LOG RightPositiveIdxStructuredStrAndLiteralInt +-LOG RightPositiveIdxStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN right(p.fName, 10) ---- 8 Alice @@ -386,14 +393,14 @@ ergerdorff movie Roma --LOG RightPositiveIdxStructuredStrAndStructuredInt +-LOG RightPositiveIdxStrAndInt -STATEMENT MATCH (o:organisation) RETURN right(o.name, o.ID) ---- 3 i Work EsWork --LOG RightNegativeIdxStructuredStrAndLiteralInt +-LOG RightNegativeIdxStrAndLiteralInt -STATEMENT MATCH (p:person) RETURN right(p.fName, -4) ---- 8 e @@ -412,14 +419,14 @@ rt Blaine Wolfeschlegelsteinhausenbergerdorff 😂😃🧘🏻‍♂️🌍🌦️🍞🚗 movie a --LOG ArrayExtractPositiveIdxStructuredStrAndStructuredInt +-LOG ArrayExtractPositiveIdxStrAndInt -STATEMENT MATCH (o:organisation) RETURN array_extract(o.name, o.ID + 2) ---- 3 F k k --LOG ArrayExtractNegativeIdxStructuredStrAndStructuredInt +-LOG ArrayExtractNegativeIdxStrAndInt -STATEMENT MATCH (o:organisation) RETURN array_extract(o.name, o.ID - 5) ---- 3 s @@ -447,7 +454,7 @@ R --LOG ListExtractStructuredString +-LOG ListExtractString -STATEMENT MATCH (o:organisation) RETURN o.name[2] ---- 3 B @@ -494,7 +501,7 @@ R --LOG SuffixStructuredStr +-LOG SuffixStr -STATEMENT MATCH (o:organisation) RETURN suffix(o.name, "Work") ---- 3 False diff --git a/test/test_files/tinysnb/path/path.test b/test/test_files/tinysnb/path/path.test index 1bba863970..c8f1a1a084 100644 --- a/test/test_files/tinysnb/path/path.test +++ b/test/test_files/tinysnb/path/path.test @@ -80,16 +80,21 @@ 4|2|2 4|2|2 4|2|2 --STATEMENT MATCH p = (a:person)-[e:knows*1..2]->(b:person) RETURN length(a) +-STATEMENT MATCH p = (a:person)-[e:knows*1..2]->(b:person) RETURN size(a) ---- error -Binder exception: Cannot match a built-in function for given function LENGTH(NODE). Supported inputs are +Binder exception: Cannot match a built-in function for given function SIZE(NODE). Supported inputs are +(VAR_LIST) -> INT64 +(MAP) -> INT64 (STRING) -> INT64 --STATEMENT MATCH p = (a:person)-[e:knows*1..2]->(b:person) RETURN len(p) +-STATEMENT MATCH p = (a:person)-[e:knows*1..2]->(b:person) RETURN size(p) ---- error -Binder exception: Cannot match a built-in function for given function LEN(RECURSIVE_REL). Supported inputs are +Binder exception: Cannot match a built-in function for given function SIZE(RECURSIVE_REL). Supported inputs are (VAR_LIST) -> INT64 (MAP) -> INT64 --STATEMENT MATCH p = (a:person)-[e:knows]->(b:person) RETURN length(e) +(STRING) -> INT64 +-STATEMENT MATCH p = (a:person)-[e:knows]->(b:person) RETURN size(e) ---- error -Binder exception: Cannot match a built-in function for given function LENGTH(REL). Supported inputs are +Binder exception: Cannot match a built-in function for given function SIZE(REL). Supported inputs are +(VAR_LIST) -> INT64 +(MAP) -> INT64 (STRING) -> INT64 diff --git a/test/test_files/tinysnb/var_length_extend/n_n.test b/test/test_files/tinysnb/var_length_extend/n_n.test index d4e86a5b0a..a38ca4e2a9 100644 --- a/test/test_files/tinysnb/var_length_extend/n_n.test +++ b/test/test_files/tinysnb/var_length_extend/n_n.test @@ -58,7 +58,7 @@ Greg [3:2]|Dan -LOG KnowsOneToTwoHopFilterTest --STATEMENT MATCH (a:person)-[e:knows*1..2 {date: date("2021-06-30")}]->(b:person) WHERE a.fName='Alice' RETURN id(rels(e)[1]), len(nodes(e)), length(e) +-STATEMENT MATCH (a:person)-[e:knows*1..2 {date: date("2021-06-30")}]->(b:person) WHERE a.fName='Alice' RETURN id(rels(e)[1]), size(nodes(e)), length(e) ---- 6 3:0|0|1 3:0|1|2