diff --git a/src/common/types/value/value.cpp b/src/common/types/value/value.cpp index d56c5a05ccb..c9eb92836e8 100644 --- a/src/common/types/value/value.cpp +++ b/src/common/types/value/value.cpp @@ -462,6 +462,9 @@ void Value::copyFromColLayout(const uint8_t* value, ValueVector* vector) { case PhysicalTypeID::STRUCT: { copyFromColLayoutStruct(*(struct_entry_t*)value, vector); } break; + case PhysicalTypeID::INTERNAL_ID: { + val.internalIDVal = *((nodeID_t*)value); + } break; default: KU_UNREACHABLE; } diff --git a/src/function/vector_list_functions.cpp b/src/function/vector_list_functions.cpp index 73b51d48e00..d813e9fc5e3 100644 --- a/src/function/vector_list_functions.cpp +++ b/src/function/vector_list_functions.cpp @@ -776,210 +776,25 @@ function_set ListProductFunction::getFunctionSet() { } static std::unique_ptr ListDistinctBindFunc( - const binder::expression_vector& arguments, Function* function) { - auto scalarFunction = ku_dynamic_cast(function); - switch (ListType::getChildType(&arguments[0]->dataType)->getLogicalTypeID()) { - case LogicalTypeID::SERIAL: - case LogicalTypeID::INT64: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT32: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT16: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT8: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT64: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT32: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT16: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT8: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT128: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::DOUBLE: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::FLOAT: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::BOOL: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::STRING: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::DATE: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_MS: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_NS: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_SEC: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_TZ: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INTERVAL: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INTERNAL_ID: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - default: { - KU_UNREACHABLE; - } - } + const binder::expression_vector& arguments, Function* /*function*/) { return std::make_unique(arguments[0]->getDataType().copy()); } function_set ListDistinctFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::LIST, nullptr, nullptr, ListDistinctBindFunc, false /* isVarlength*/)); + result.push_back(std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::LIST, + ScalarFunction::UnaryExecNestedTypeFunction, + nullptr, ListDistinctBindFunc, false /* isVarlength*/)); return result; } -static std::unique_ptr ListUniqueBindFunc( - const binder::expression_vector& arguments, Function* function) { - auto scalarFunction = ku_dynamic_cast(function); - switch (ListType::getChildType(&arguments[0]->dataType)->getLogicalTypeID()) { - case LogicalTypeID::SERIAL: - case LogicalTypeID::INT64: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT32: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT16: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT8: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT64: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT32: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT16: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::UINT8: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INT128: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::DOUBLE: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::FLOAT: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::BOOL: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::STRING: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::DATE: { - scalarFunction->execFunc = - ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_MS: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_NS: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_SEC: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::TIMESTAMP_TZ: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INTERVAL: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - case LogicalTypeID::INTERNAL_ID: { - scalarFunction->execFunc = ScalarFunction::UnaryExecNestedTypeFunction>; - } break; - default: { - KU_UNREACHABLE; - } - } - return std::make_unique(LogicalType::INT64()); -} - function_set ListUniqueFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::INT64, nullptr, nullptr, ListUniqueBindFunc, false /* isVarlength*/)); + result.push_back(std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::INT64, + ScalarFunction::UnaryExecNestedTypeFunction, + false /* isVarlength*/)); return result; } diff --git a/src/include/function/list/functions/list_distinct_function.h b/src/include/function/list/functions/list_distinct_function.h index 0a9f9523645..8ac0665f8c3 100644 --- a/src/include/function/list/functions/list_distinct_function.h +++ b/src/include/function/list/functions/list_distinct_function.h @@ -1,37 +1,26 @@ #pragma once -#include - #include "common/vector/value_vector.h" +#include "list_unique_function.h" namespace kuzu { namespace function { -template struct ListDistinct { static inline void operation(common::list_entry_t& input, common::list_entry_t& result, common::ValueVector& inputVector, common::ValueVector& resultVector) { - std::set uniqueValues; - auto inputValues = - reinterpret_cast(common::ListVector::getListValues(&inputVector, input)); - auto inputDataVector = common::ListVector::getDataVector(&inputVector); - - for (auto i = 0u; i < input.size; i++) { - if (inputDataVector->isNull(input.offset + i)) { - continue; - } - uniqueValues.insert(inputValues[i]); - } - - result = common::ListVector::addList(&resultVector, uniqueValues.size()); - auto resultValues = common::ListVector::getListValues(&resultVector, result); + auto numUniqueValues = ListUnique::appendListElementsToValueSet(input, inputVector); + result = common::ListVector::addList(&resultVector, numUniqueValues); auto resultDataVector = common::ListVector::getDataVector(&resultVector); - auto numBytesPerValue = inputDataVector->getNumBytesPerValue(); - for (auto val : uniqueValues) { - resultDataVector->copyFromVectorData(resultValues, inputDataVector, - reinterpret_cast(&val)); - resultValues += numBytesPerValue; - } + auto resultDataVectorBuffer = + common::ListVector::getListValuesWithOffset(&resultVector, result, 0 /* offset */); + ListUnique::appendListElementsToValueSet(input, inputVector, nullptr, + [&resultDataVector, &resultDataVectorBuffer](common::ValueVector& dataVector, + uint64_t pos) -> void { + resultDataVector->copyFromVectorData(resultDataVectorBuffer, &dataVector, + dataVector.getData() + pos * dataVector.getNumBytesPerValue()); + resultDataVectorBuffer += dataVector.getNumBytesPerValue(); + }); } }; diff --git a/src/include/function/list/functions/list_unique_function.h b/src/include/function/list/functions/list_unique_function.h index e25fd14abde..42f0c63bb7c 100644 --- a/src/include/function/list/functions/list_unique_function.h +++ b/src/include/function/list/functions/list_unique_function.h @@ -1,28 +1,53 @@ #pragma once -#include - +#include "common/type_utils.h" +#include "common/types/value/value.h" #include "common/vector/value_vector.h" namespace kuzu { namespace function { -template -struct ListUnique { - static inline void operation(common::list_entry_t& input, int64_t& result, - common::ValueVector& inputVector, common::ValueVector& /*resultVector*/) { - std::set uniqueValues; - auto inputValues = - reinterpret_cast(common::ListVector::getListValues(&inputVector, input)); - auto inputDataVector = common::ListVector::getDataVector(&inputVector); +struct ValueHashFunction { + uint64_t operator()(const common::Value& value) const { return (uint64_t)value.computeHash(); } +}; + +struct ValueEquality { + bool operator()(const common::Value& a, const common::Value& b) const { return a == b; } +}; + +using ValueSet = std::unordered_set; +using duplicateValueHandler = std::function; +using uniqueValueHandler = std::function; + +struct ListUnique { + static uint64_t appendListElementsToValueSet(common::list_entry_t& input, + common::ValueVector& inputVector, duplicateValueHandler duplicateValHandler = nullptr, + uniqueValueHandler uniqueValueHandler = nullptr) { + ValueSet uniqueKeys; + auto dataVector = common::ListVector::getDataVector(&inputVector); + auto val = common::Value::createDefaultValue(dataVector->dataType); for (auto i = 0u; i < input.size; i++) { - if (inputDataVector->isNull(input.offset + i)) { + if (dataVector->isNull(input.offset + i)) { continue; } - uniqueValues.insert(inputValues[i]); + auto entryVal = common::ListVector::getListValuesWithOffset(&inputVector, input, i); + val.copyFromColLayout(entryVal, dataVector); + auto uniqueKey = uniqueKeys.insert(val).second; + if (duplicateValHandler != nullptr && !uniqueKey) { + duplicateValHandler( + common::TypeUtils::entryToString(dataVector->dataType, entryVal, dataVector)); + } + if (uniqueValueHandler != nullptr && uniqueKey) { + uniqueValueHandler(*dataVector, input.offset + i); + } } - result = uniqueValues.size(); + return uniqueKeys.size(); + } + + static void operation(common::list_entry_t& input, int64_t& result, + common::ValueVector& inputVector, common::ValueVector& /*resultVector*/) { + result = appendListElementsToValueSet(input, inputVector); } }; diff --git a/src/include/function/map/functions/map_creation_function.h b/src/include/function/map/functions/map_creation_function.h index cbd7476dcdb..4d63d79f0c4 100644 --- a/src/include/function/map/functions/map_creation_function.h +++ b/src/include/function/map/functions/map_creation_function.h @@ -1,36 +1,19 @@ #pragma once -#include "unordered_set" - #include "common/exception/runtime.h" #include "common/type_utils.h" #include "common/types/value/value.h" #include "common/vector/value_vector.h" +#include "function/list/functions/list_unique_function.h" namespace kuzu { namespace function { -struct ValueHashFunction { - uint64_t operator()(const common::Value& value) const { return (uint64_t)value.computeHash(); } -}; - -struct ValueEquality { - bool operator()(const common::Value& a, const common::Value& b) const { return a == b; } -}; - static void validateKeys(common::list_entry_t& keyEntry, common::ValueVector& keyVector) { - std::unordered_set uniqueKeys; - auto dataVector = common::ListVector::getDataVector(&keyVector); - auto val = common::Value::createDefaultValue(dataVector->dataType); - for (auto i = 0u; i < keyEntry.size; i++) { - auto entryVal = common::ListVector::getListValuesWithOffset(&keyVector, keyEntry, i); - val.copyFromColLayout(entryVal, dataVector); - auto unique = uniqueKeys.insert(val).second; - if (!unique) { - throw common::RuntimeException{common::stringFormat("Found duplicate key: {} in map.", - common::TypeUtils::entryToString(dataVector->dataType, entryVal, dataVector))}; - } - } + ListUnique::appendListElementsToValueSet(keyEntry, keyVector, [](const std::string& key) { + throw common::RuntimeException{ + common::stringFormat("Found duplicate key: {} in map.", key)}; + }); } struct MapCreation { diff --git a/test/test_files/tinysnb/function/list.test b/test/test_files/tinysnb/function/list.test index 2a09e64c1a7..96d8143a342 100644 --- a/test/test_files/tinysnb/function/list.test +++ b/test/test_files/tinysnb/function/list.test @@ -1608,22 +1608,22 @@ True -LOG ListDistinctWithInt8 -STATEMENT Return list_distinct([to_int8(1), to_int8(1), NULL, to_int8(-3), to_int8(1), to_int8(5)]); ---- 1 -[-3,1,5] +[1,-3,5] -LOG ListDistinctWithInt16 -STATEMENT Return list_distinct([to_int16(1), to_int16(1), NULL, to_int16(-3), to_int16(1), to_int16(5)]); ---- 1 -[-3,1,5] +[1,-3,5] -LOG ListDistinctWithInt32 -STATEMENT Return list_distinct([to_int32(1), to_int32(1), NULL, to_int32(-3), to_int32(1), to_int32(5)]); ---- 1 -[-3,1,5] +[1,-3,5] -LOG ListDistinctWithInt64 -STATEMENT Return list_distinct([1, 1, NULL, -3, 1, 5]); ---- 1 -[-3,1,5] +[1,-3,5] -LOG ListDistinctWithUInt8 -STATEMENT Return list_distinct([to_uint8(1), to_uint8(1), NULL, to_uint8(3), to_uint8(1), to_uint8(5)]); @@ -1648,27 +1648,27 @@ True -LOG ListDistinctWithInt128 -STATEMENT Return list_distinct([to_int128(1), to_int128(1), NULL, to_int128(-3), to_int128(1), to_int128(5)]); ---- 1 -[-3,1,5] +[1,-3,5] -LOG ListDistinctWithFloat -STATEMENT Return list_distinct([to_float(1.1), to_float(1.1), NULL, to_float(3.4), to_float(1.2), to_float(5.1)]); ---- 1 -[1.100000,1.200000,3.400000,5.100000] +[1.100000,3.400000,1.200000,5.100000] -LOG ListDistinctWithDouble -STATEMENT Return list_distinct([1.1, 1.1, NULL, -3.4, 1.2, 5.1]); ---- 1 -[-3.400000,1.100000,1.200000,5.100000] +[1.100000,-3.400000,1.200000,5.100000] -LOG ListDistinctBoolean -STATEMENT Return list_distinct([true, true, NULL, false, false]); ---- 1 -[False,True] +[True,False] -LOG ListDistinctWithStringSeq1 -STATEMENT Return list_distinct(['this is a long string', 'this is a long string', NULL, 'bbb', 'ccc', 'ccc']); ---- 1 -[bbb,ccc,this is a long string] +[this is a long string,bbb,ccc] -LOG ListDistinctWithStringSeq2 -STATEMENT MATCH (a:person) RETURN list_distinct([NULL, a.usedNames[1], a.usedNames[1], NULL]) @@ -1690,16 +1690,16 @@ True -LOG ListDistinctWithTimestamp -STATEMENT Return list_distinct([timestamp('1992-05-03 11:13:25'), timestamp('1994-05-03 11:13:25'), timestamp('1993-05-03 11:13:25'), timestamp('1994-05-03 11:13:25'), NULL]); ---- 1 -[1992-05-03 11:13:25,1993-05-03 11:13:25,1994-05-03 11:13:25] +[1992-05-03 11:13:25,1994-05-03 11:13:25,1993-05-03 11:13:25] -STATEMENT Return list_distinct([cast('1993-05-03 11:13:25.012343', "TIMESTAMP_TZ"), cast('1993-05-03 11:13:25.000343', "TIMESTAMP_TZ"), cast('1994-05-03 11:13:25', "TIMESTAMP_TZ"), cast('1993-05-03 11:13:25', "TIMESTAMP_TZ"), cast('1994-05-03 11:13:25', "TIMESTAMP_TZ"), NULL]); ---- 1 -[1993-05-03 11:13:25+00,1993-05-03 11:13:25.000343+00,1993-05-03 11:13:25.012343+00,1994-05-03 11:13:25+00] +[1993-05-03 11:13:25.012343+00,1993-05-03 11:13:25.000343+00,1994-05-03 11:13:25+00,1993-05-03 11:13:25+00] -STATEMENT Return list_distinct([cast('1993-05-03 11:13:25.012343', "TIMESTAMP_NS"), cast('1993-05-03 11:13:25.000343', "TIMESTAMP_NS"), cast('1994-05-03 11:13:25', "TIMESTAMP_NS"), cast('1993-05-03 11:13:25', "TIMESTAMP_NS"), cast('1994-05-03 11:13:25', "TIMESTAMP_NS"), NULL]); ---- 1 -[1993-05-03 11:13:25,1993-05-03 11:13:25.000343,1993-05-03 11:13:25.012343,1994-05-03 11:13:25] +[1993-05-03 11:13:25.012343,1993-05-03 11:13:25.000343,1994-05-03 11:13:25,1993-05-03 11:13:25] -STATEMENT Return list_distinct([cast('1993-05-03 11:13:25.012343', "TIMESTAMP_MS"), cast('1993-05-03 11:13:25.000343', "TIMESTAMP_MS"), cast('1994-05-03 11:13:25', "TIMESTAMP_MS"), cast('1993-05-03 11:13:25', "TIMESTAMP_MS"), cast('1994-05-03 11:13:25', "TIMESTAMP_MS"), NULL]); ---- 1 -[1993-05-03 11:13:25,1993-05-03 11:13:25.012,1994-05-03 11:13:25] +[1993-05-03 11:13:25.012,1993-05-03 11:13:25,1994-05-03 11:13:25] -STATEMENT Return list_distinct([cast('1993-05-03 11:13:25.012343', "TIMESTAMP_SEC"), cast('1993-05-03 11:13:25.000343', "TIMESTAMP_SEC"), cast('1994-05-03 11:13:25', "TIMESTAMP_SEC"), cast('1993-05-03 11:13:25', "TIMESTAMP_SEC"), cast('1994-05-03 11:13:25', "TIMESTAMP_SEC"), NULL]); ---- 1 [1993-05-03 11:13:25,1994-05-03 11:13:25] @@ -1721,6 +1721,49 @@ True [0:6] [0:7] +-LOG ListDistinctWithList +-STATEMENT MATCH (p:person) RETURN list_distinct([p.usedNames, p.usedNames, ['Carmen','Fred']]) +---- 8 +[[Ad,De,Hi,Kye,Orlan],[Carmen,Fred]] +[[Aida],[Carmen,Fred]] +[[Bobby],[Carmen,Fred]] +[[Carmen,Fred]] +[[Ein],[Carmen,Fred]] +[[Fesdwe],[Carmen,Fred]] +[[Grad],[Carmen,Fred]] +[[Wolfeschlegelstein,Daniel],[Carmen,Fred]] + +-LOG ListDistinctWithArray +-STATEMENT MATCH (p:person) RETURN list_distinct([p.grades, p.grades, cast([80,78,34,83], "int64[4]")]) +---- 8 +[[43,83,67,43],[80,78,34,83]] +[[76,88,99,89],[80,78,34,83]] +[[77,64,100,54],[80,78,34,83]] +[[80,78,34,83]] +[[91,75,21,95],[80,78,34,83]] +[[96,54,86,92],[80,78,34,83]] +[[96,59,65,88],[80,78,34,83]] +[[98,42,93,88],[80,78,34,83]] + +-LOG ListDistinctWithStruct +-STATEMENT MATCH (o:organisation) RETURN list_distinct([o.state, o.state, {'revenue': cast(138, 'int16'), location: ["'toronto'", "'montr,eal'"], stock: {price: [96, 56], volume: 1000}}]) +---- 3 +[{revenue: 138, location: ['toronto','montr,eal'], stock: {price: [96,56], volume: 1000}}] +[{revenue: 152, location: ["vanco,uver north area"], stock: {price: [15,78,671], volume: 432}},{revenue: 138, location: ['toronto','montr,eal'], stock: {price: [96,56], volume: 1000}}] +[{revenue: 558, location: ['very long city name','new york'], stock: {price: [22], volume: 99}},{revenue: 138, location: ['toronto','montr,eal'], stock: {price: [96,56], volume: 1000}}] + +-LOG ListDistinctWithUUID +-STATEMENT MATCH (p:person) RETURN list_distinct([p.u, p.u, cast('a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a14', "uuid")]) +---- 8 +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a13,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a15,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a16,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] +[a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14] + -LOG ListDistinctWithInt8 -STATEMENT Return list_unique([to_int8(1), to_int8(1), NULL, to_int8(-3), to_int8(1), to_int8(5)]); ---- 1 @@ -1837,6 +1880,61 @@ True 1 1 +-LOG ListUniqueWithUUID +-STATEMENT MATCH (p:person) RETURN list_unique([p.u, p.u, cast('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11', 'uuid')]); +---- 8 +1 +2 +2 +2 +2 +2 +2 +2 + +-LOG ListUniqueWithList +-STATEMENT MATCH (p:person) RETURN list_unique([p.courseScoresPerTerm, p.courseScoresPerTerm, [[8,9],[9,10]]]), p.ID; +---- 8 +1|2 +2|0 +2|3 +2|5 +2|7 +2|8 +2|9 +2|10 + +-LOG ListUniqueWithArray +-STATEMENT MATCH (p:person) RETURN list_unique([p.grades, p.grades, cast([96,59,65,88], "int64[4]")]), p.ID; +---- 8 +2|0 +2|2 +2|3 +2|5 +1|7 +2|8 +2|9 +2|10 + +-LOG ListUniqueWithStruct +-STATEMENT MATCH (o:organisation) RETURN list_unique([o.state, o.state, {revenue: cast(558, "int16"), location: ["'very long city name'", "'new york'"], stock: {price: [22], volume: 99}}]), o.ID; +---- 3 +2|1 +2|4 +1|6 + +-LOG ListUniqueWithUUID +-STATEMENT MATCH (p:person) RETURN list_unique([p.u, p.u, cast('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11', 'uuid')]), p.ID; +---- 8 +1|0 +2|10 +2|2 +2|3 +2|5 +2|7 +2|8 +2|9 + -LOG ListAnyValueWithInt8 -STATEMENT Return list_any_value([NULL, to_int8(1), to_int8(1), NULL, to_int8(-3), to_int8(1), to_int8(5)]); ---- 1