From c1431927b97e59fadc05b41db5619558c3cbbc14 Mon Sep 17 00:00:00 2001 From: AEsir777 Date: Fri, 10 Nov 2023 15:48:23 -0500 Subject: [PATCH] finish implemention of cast VarList to VarList --- .../function_evaluator.cpp | 6 +- src/function/vector_cast_functions.cpp | 153 +++++++++++------- src/include/common/null_mask.h | 2 +- src/include/common/vector/auxiliary_buffer.h | 1 + src/include/common/vector/value_vector.h | 5 + src/include/function/scalar_function.h | 9 +- .../function/unary_function_executor.h | 12 +- test/test_files/tinysnb/cast/cast_error.test | 11 ++ .../tinysnb/cast/cast_to_nested_types.test | 34 ++++ test/test_files/tinysnb/function/cast.test | 51 ++++-- 10 files changed, 203 insertions(+), 81 deletions(-) diff --git a/src/expression_evaluator/function_evaluator.cpp b/src/expression_evaluator/function_evaluator.cpp index 033b58ab942..886e46d70c9 100644 --- a/src/expression_evaluator/function_evaluator.cpp +++ b/src/expression_evaluator/function_evaluator.cpp @@ -22,10 +22,8 @@ void FunctionExpressionEvaluator::evaluate() { child->evaluate(); } auto expr = reinterpret_cast(expression.get()); - if (expr->getFunctionName() == CAST_FUNC_NAME && - parameters[0]->dataType.getLogicalTypeID() == LogicalTypeID::STRING) { - execFunc(parameters, *resultVector, - reinterpret_cast(expr->getBindData())); + if (expr->getFunctionName() == CAST_FUNC_NAME) { + execFunc(parameters, *resultVector, expr->getBindData()); return; } if (execFunc != nullptr) { diff --git a/src/function/vector_cast_functions.cpp b/src/function/vector_cast_functions.cpp index 80a18fce607..61504a9a333 100644 --- a/src/function/vector_cast_functions.cpp +++ b/src/function/vector_cast_functions.cpp @@ -34,9 +34,10 @@ static void castFixedListToString( resultVector.setValue(resultPos, result); } +template static void fixedListCastExecFunction(const std::vector>& params, ValueVector& result, void* /*dataPtr*/ = nullptr) { - assert(params.size() == 1); + KU_ASSERT(params.size() == 1); auto param = params[0]; if (param->state->isFlat()) { castFixedListToString(*param, param->state->selVector->selectedPositions[0], result, @@ -53,10 +54,25 @@ static void fixedListCastExecFunction(const std::vector +template<> +void fixedListCastExecFunction( + const std::vector>& params, ValueVector& result, + void* /*dataPtr*/) { + KU_ASSERT(params.size() == 1); + + auto inputVector = params[0].get(); + auto childNum = ListVector::getDataVectorSize(inputVector); + auto inputChildVector = (ListVector::getDataVector(inputVector)); + auto resultChildVector = (ListVector::getDataVector(&result)); + for (auto i = 0u; i < childNum; i++) { + castFixedListToString(*inputChildVector, i, *resultChildVector, i); + } +} + +template static void StringtoFixedListCastExecFunction( const std::vector>& params, ValueVector& result, void* dataPtr) { - assert(params.size() == 1); + KU_ASSERT(params.size() == 1); auto param = params[0]; auto csvReaderConfig = &reinterpret_cast(dataPtr)->csvConfig; if (param->state->isFlat()) { @@ -90,36 +106,61 @@ static void StringtoFixedListCastExecFunction( template<> void StringtoFixedListCastExecFunction( const std::vector>& params, ValueVector& result, void* dataPtr) { + KU_ASSERT(params.size() == 1 && + params[0]->dataType.getLogicalTypeID() == LogicalTypeID::VAR_LIST && + result.dataType.getLogicalTypeID() == LogicalTypeID::VAR_LIST); + auto csvReaderConfig = &reinterpret_cast(dataPtr)->csvConfig; -} - -template -static void varListCastExecFunction(const std::vector>& params, - ValueVector& result, void* dataPtr) { - assert(params.size() == 1); - auto inputVector = params[0]; - scalar_exec_func func = CastFunction::bindCastFunction("CAST", - inputVector->dataType.getLogicalTypeID(), result.dataType.getLogicalTypeID()) - ->execFunc; - for (auto i = 0u; i < inputVector->state->selVector->selectedSize; i++) { - auto pos = inputVector->state->selVector->selectedPositions[i]; - result.setNull(pos, inputVector->isNull(pos)); - if (!result.isNull(pos)) { - auto input_list_entry = inputVector->getValue(pos); - auto result_list_entry = ListVector::addList(&result, input_list_entry.size); - result.setValue(pos, result_list_entry); + auto inputVector = params[0].get(); + auto childNum = ListVector::getDataVectorSize(inputVector); + auto inputChildVector = (ListVector::getDataVector(inputVector)); + auto resultChildVector = (ListVector::getDataVector(&result)); + for (auto i = 0u; i < childNum; i++) { + resultChildVector->setNull(i, inputChildVector->isNull(i)); + if (!resultChildVector->isNull(i)) { + CastString::castToFixedList( + inputChildVector->getValue(i), resultChildVector, i, csvReaderConfig); } } - func(params, result, dataPtr); } -template<> -void varListCastExecFunction( +static void varListCastExecFunction( const std::vector>& params, ValueVector& result, void* dataPtr) { KU_ASSERT(params.size() == 1); - auto inputChildVector = params[0]; - - // TODO: Kebing finish this one + result.resetAuxiliaryBuffer(); + auto inputVector = params[0]; + auto resultVector = &result; + + auto childNum = ListVector::getDataVectorSize(inputVector.get()); + ListVector::addList(&result, childNum); + auto listEntrySize = inputVector->state->selVector + ->selectedPositions[inputVector->state->selVector->selectedSize - 1] + + 1; + memcpy(resultVector->getData(), inputVector->getData(), + listEntrySize * resultVector->getNumBytesPerValue()); + resultVector->setNullFromBits(inputVector->getNullMaskData(), 0, 0, listEntrySize); + + // resolve to the lowest level dataVector + auto inputChildTypeID = VarListType::getChildType(&inputVector->dataType)->getLogicalTypeID(); + auto resultChildTypeID = VarListType::getChildType(&resultVector->dataType)->getLogicalTypeID(); + while (inputChildTypeID == LogicalTypeID::VAR_LIST && + resultChildTypeID == LogicalTypeID::VAR_LIST) { + inputVector = ListVector::getSharedDataVector(inputVector.get()); + resultVector = ListVector::getDataVector(resultVector); + inputChildTypeID = VarListType::getChildType(&inputVector->dataType)->getLogicalTypeID(); + resultChildTypeID = VarListType::getChildType(&resultVector->dataType)->getLogicalTypeID(); + + // copy NULL musk and list entry + memcpy(resultVector->getData(), inputVector->getData(), childNum * resultVector->getNumBytesPerValue()); + resultVector->setNullFromBits(inputVector->getNullMaskData(), 0, 0, childNum); + childNum = ListVector::getDataVectorSize(inputVector.get()); + ListVector::addList(resultVector, childNum); + } + scalar_exec_func func = CastFunction::bindCastFunction( + "CAST", inputChildTypeID, resultChildTypeID) + ->execFunc; + std::vector> childParams{inputVector}; + func(childParams, *resultVector, dataPtr); } bool CastFunction::hasImplicitCast(const LogicalType& srcType, const LogicalType& dstType) { @@ -165,12 +206,12 @@ static std::unique_ptr bindCastFromStringFunction( ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::TIMESTAMP: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, timestamp_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::INTERVAL: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, interval_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::BLOB: { execFunc = @@ -185,16 +226,16 @@ static std::unique_ptr bindCastFromStringFunction( ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::DOUBLE: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, double_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::FLOAT: { execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::INT128: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, int128_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::SERIAL: case LogicalTypeID::INT64: { @@ -214,35 +255,35 @@ static std::unique_ptr bindCastFromStringFunction( ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::UINT64: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, uint64_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::UINT32: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, uint32_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::UINT16: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, uint16_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::UINT8: { execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::VAR_LIST: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, list_entry_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::FIXED_LIST: { execFunc = StringtoFixedListCastExecFunction; } break; case LogicalTypeID::MAP: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, map_entry_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::STRUCT: { - execFunc = ScalarFunction::UnaryCastStringExecFunction< - ku_string_t, struct_entry_t, CastString, EXECUTOR>; + execFunc = ScalarFunction::UnaryCastStringExecFunction; } break; case LogicalTypeID::UNION: { execFunc = ScalarFunction::UnaryCastStringExecFunction bindCastToStringFunction( EXECUTOR>; } break; case LogicalTypeID::FIXED_LIST: { - func = fixedListCastExecFunction; + func = fixedListCastExecFunction; } break; case LogicalTypeID::MAP: { func = @@ -473,17 +514,20 @@ static std::unique_ptr bindCastToNumericFunction( functionName, std::vector{sourceTypeID}, targetTypeID, func); } -template +template static std::unique_ptr bindCastBetweenNested( const std::string& functionName, LogicalTypeID sourceTypeID, LogicalTypeID targetTypeID) { scalar_exec_func func; switch (sourceTypeID) { case LogicalTypeID::VAR_LIST: { - func = varListCastExecFunction; + func = varListCastExecFunction; } break; default: + // lcov_excl_start + // TODO(kebing): implement more throw ConversionException{stringFormat("Unsupported casting function from {} to {}.", LogicalTypeUtils::toString(sourceTypeID), LogicalTypeUtils::toString(targetTypeID))}; + // lcov_excl_end } return std::make_unique( functionName, std::vector{sourceTypeID}, targetTypeID, func); @@ -495,7 +539,8 @@ static std::unique_ptr bindCastToTimestampFunction( scalar_exec_func func; switch (sourceTypeID) { case LogicalTypeID::DATE: { - func = ScalarFunction::UnaryExecFunction; + func = + ScalarFunction::UnaryExecFunction; } break; default: throw ConversionException{stringFormat("Unsupported casting function from {} to TIMESTAMP.", @@ -570,8 +615,7 @@ std::unique_ptr CastFunction::bindCastFunction( return bindCastToTimestampFunction(functionName, sourceTypeID); } case LogicalTypeID::VAR_LIST: { - return bindCastBetweenNested( - functionName, sourceTypeID, targetTypeID); + return bindCastBetweenNested(functionName, sourceTypeID, targetTypeID); } default: { throw ConversionException{stringFormat("Unsupported casting function from {} to {}.", @@ -810,10 +854,7 @@ std::unique_ptr CastAnyFunction::bindFunc( func->execFunc = CastFunction::bindCastFunction(func->name, inputTypeID, outputType->getLogicalTypeID()) ->execFunc; - if (inputTypeID == LogicalTypeID::STRING) { - return std::make_unique(*outputType); - } - return std::make_unique(*outputType); + return std::make_unique(*outputType); } function_set CastAnyFunction::getFunctionSet() { diff --git a/src/include/common/null_mask.h b/src/include/common/null_mask.h index 7739bafd40a..e6e6827b74e 100644 --- a/src/include/common/null_mask.h +++ b/src/include/common/null_mask.h @@ -115,7 +115,7 @@ class NullMask { // const because updates to the data must set mayContainNulls if any value // becomes non-null - // Modifying the underlying data shuld be done with setNull or copyFromNullData + // Modifying the underlying data should be done with setNull or copyFromNullData inline const uint64_t* getData() { return data; } static inline uint64_t getNumNullEntries(uint64_t numNullBits) { diff --git a/src/include/common/vector/auxiliary_buffer.h b/src/include/common/vector/auxiliary_buffer.h index 16babdcbee0..3f281ad9a6a 100644 --- a/src/include/common/vector/auxiliary_buffer.h +++ b/src/include/common/vector/auxiliary_buffer.h @@ -73,6 +73,7 @@ class ListAuxiliaryBuffer : public AuxiliaryBuffer { dataVector = std::move(vector); } inline ValueVector* getDataVector() const { return dataVector.get(); } + inline std::shared_ptr getSharedDataVector() const { return dataVector; } list_entry_t addList(uint64_t listSize); diff --git a/src/include/common/vector/value_vector.h b/src/include/common/vector/value_vector.h index 19baa4ff0f6..6286083deba 100644 --- a/src/include/common/vector/value_vector.h +++ b/src/include/common/vector/value_vector.h @@ -147,6 +147,11 @@ class ListVector { return reinterpret_cast(vector->auxiliaryBuffer.get()) ->getDataVector(); } + static inline std::shared_ptr getSharedDataVector(const ValueVector* vector) { + KU_ASSERT(vector->dataType.getPhysicalType() == PhysicalTypeID::VAR_LIST); + return reinterpret_cast(vector->auxiliaryBuffer.get()) + ->getSharedDataVector(); + } static inline uint64_t getDataVectorSize(const ValueVector* vector) { KU_ASSERT(vector->dataType.getPhysicalType() == PhysicalTypeID::VAR_LIST); return reinterpret_cast(vector->auxiliaryBuffer.get())->getSize(); diff --git a/src/include/function/scalar_function.h b/src/include/function/scalar_function.h index d6957bbb83f..c9b5eddbb62 100644 --- a/src/include/function/scalar_function.h +++ b/src/include/function/scalar_function.h @@ -116,9 +116,8 @@ struct ScalarFunction : public BaseScalarFunction { const std::vector>& params, common::ValueVector& result, void* dataPtr) { KU_ASSERT(params.size() == 1); - EXECUTOR::template executeSwitch< - OPERAND_TYPE, RESULT_TYPE, FUNC, UnaryCastStringFunctionWrapper> - (*params[0], result, dataPtr); + EXECUTOR::template executeSwitch(*params[0], result, dataPtr); } template>& params, common::ValueVector& result, void* /*dataPtr*/ = nullptr) { KU_ASSERT(params.size() == 1); - EXECUTOR::template executeSwitch(*params[0], result, nullptr /* dataPtr */); + EXECUTOR::template executeSwitch( + *params[0], result, nullptr /* dataPtr */); } template - static void executeSwitch(common::ValueVector& operand, common::ValueVector& result, - void* dataPtr) { + static void executeSwitch( + common::ValueVector& operand, common::ValueVector& result, void* dataPtr) { // this vector is of var list type and the child vector is of non-nested types then cast - KU_ASSERT(operand.dataType.getLogicalTypeID() == common::LogicalTypeID::VAR_LIST); - result.resetAuxiliaryBuffer(); + KU_ASSERT(operand.dataType.getLogicalTypeID() == common::LogicalTypeID::VAR_LIST && + result.dataType.getLogicalTypeID() == common::LogicalTypeID::VAR_LIST); auto childNum = common::ListVector::getDataVectorSize(&operand); + auto inputChildVector = common::ListVector::getDataVector(&operand); + auto resultChildVector = (common::ListVector::getDataVector(&result)); for (auto i = 0u; i < childNum; i++) { - auto inputChildVector = (common::ListVector::getDataVector(&operand)); - auto resultChildVector = (common::ListVector::getDataVector(&operand)); resultChildVector->setNull(i, inputChildVector->isNull(i)); if (!resultChildVector->isNull(i)) { // cast position i in child data vector diff --git a/test/test_files/tinysnb/cast/cast_error.test b/test/test_files/tinysnb/cast/cast_error.test index ca28f9c42b4..a7d8bd4b45f 100644 --- a/test/test_files/tinysnb/cast/cast_error.test +++ b/test/test_files/tinysnb/cast/cast_error.test @@ -702,3 +702,14 @@ Conversion exception: Unsupported casting function from REL to TIMESTAMP. -STATEMENT MATCH (:person)-[e:studyAt*1..3]->(:organisation) return cast(e, "INT64"); ---- error Conversion exception: Unsupported casting function from RECURSIVE_REL to INT64. + +-LOG InvalidVarListToVarList +-STATEMENT RETURN cast([31231], "INT64[][]"); +---- error +Conversion exception: Unsupported casting function from INT64 to VAR_LIST. +-STATEMENT RETURN cast([-1], "UINT8[]"); +---- error +Overflow exception: Value -1 is not within UINT8 range +-STATEMENT RETURN cast([[1, 1]], "UINT8[]"); +---- error +Conversion exception: Unsupported casting function from VAR_LIST to UINT8. diff --git a/test/test_files/tinysnb/cast/cast_to_nested_types.test b/test/test_files/tinysnb/cast/cast_to_nested_types.test index 6527fb5b673..c83b84379eb 100644 --- a/test/test_files/tinysnb/cast/cast_to_nested_types.test +++ b/test/test_files/tinysnb/cast/cast_to_nested_types.test @@ -124,6 +124,12 @@ False|-4325||18446744073709551616.000000| dfsa ---- 2 [3324.123047,342423.437500,432.122986] [1.000000,4231.000000,432.122986] +-STATEMENT RETURN cast("[423, 321, 423]", "INT64[3]"), cast(null, "INT64[5]"), cast("[432.43214]", "FLOAT[1]"), cast("[4, -5]", "double[2]"), cast("[4234, 42312, 432, 1321]", "INT32[4]"), cast("[-32768]", "INT16[1]") +---- 1 +[423,321,423]||[432.432129]|[4.000000,-5.000000]|[4234,42312,432,1321]|[-32768] +-STATEMENT Return cast(cast(-4324324, "int128"), "int64") +---- 1 +-4324324 -LOG CastToMap -STATEMENT RETURN cast(" { c= {a = 3423 }, b = { g = 3421 } } ", "MAP(STRING, MAP(STRING, INT16))"), cast("{}", "MAP(STRING, MAP(STRING, INT16))"), cast("{d = {}}", "MAP(STRING, MAP(STRING, INT16))"); @@ -168,3 +174,31 @@ True|2019-03-19|-12.343200|32768| 1|-2147483648|1970-01-01 10:00:00.004666|-32769.000000|fsdxcv 0|0|2014-05-12 12:11:59|4324254534123134124032.000000|fsaf False|-4325|14|18446744073709551616.000000| dfsa + +-LOG CastVarListToVarList +-STATEMENT RETURN cast([321, 432], "DOUBLE[]"), cast([321, 432], "FLOAT[]"), cast([321, 432], "INT128[]"), cast([321, 432], "INT64[]"), cast([321, 432], "INT32[]"), cast([321, 432], "INT16[]"), cast([-1, -43], "INT8[]"), cast([0, 23], "UINT8[]"), cast([0, 23], "UINT16[]"), cast([0, 23], "UINT32[]"), cast([0, 23], "UINT64[]"), cast([5435234412435123, -432425341231], "STRING[]"); +---- 1 +[321.000000,432.000000]|[321.000000,432.000000]|[321,432]|[321,432]|[321,432]|[321,432]|[-1,-43]|[0,23]|[0,23]|[0,23]|[0,23]|[5435234412435123,-432425341231] +-STATEMENT RETURN cast([], "UINT64[]"), cast([NULL,], "UINT64[]"), cast(NULL, "UINT64[]"), cast([NULL, 432124, 0, NULL], "UINT64[]"); +---- 1 +[]|[,]||[,432124,0,] + +-LOG CastNestedVarListToNestedVarList +-STATEMENT RETURN cast([[4324.2312, 432.321, 43242.543], [31214.59,4132.72], NULL, [NULL,,4324.32]], "INT64[][]"); +---- 1 +[[4324,432,43243],[31215,4133],,[,,4324]] +-STATEMENT RETURN cast(["[123, 3234]", "[124, 3241]", NULL, "[0, -4324234]"], "INT64[2][]"), cast(cast(["[123, 3234]", "[124, 3241]", NULL, "[0, -4324234]"], "DOUBLE[2][]"), "STRING[]"); +---- 1 +[[123,3234],[124,3241],,[0,-4324234]]|[[123.000000,3234.000000],[124.000000,3241.000000],,[0.000000,-4324234.000000]] +-STATEMENT RETURN cast([NULL, NULL, NULL], "INT8[][][]"), cast([NULL], "STRING[]"), cast([], "UINT8[]"); +---- 1 +[,,]|[]|[] +-STATEMENT RETURN cast(cast([NULL, [NULL, 13], NULL, [14, 14], NULL], "INT32[][]"), "INT128[][]"), cast([NULL, 1], "INT16[]"), cast("[1, NULL, NULL]", "UINT32[]"), cast("[NULL, 1, NULL]", "UINT64[]"); +---- 1 +[,[,13],,[14,14],]|[,1]|[1,,]|[,1,] +-STATEMENT RETURN cast(NULL, "INT32[][]"); +---- 1 + +-STATEMENT RETURN cast(cast(cast(cast(["[NULL, [NULL, 1, 0, 2], NULL, [1, 2, 3, 4, 5], NULL]", "[[1, 2, 3], [4, 5, 6]]"], "UINT8[][][]"), "UINT16[][][]"), "INT32[][][]"), "DOUBLE[][][]"); +---- 1 +[[,[,1.000000,0.000000,2.000000],,[1.000000,2.000000,3.000000,4.000000,5.000000],],[[1.000000,2.000000,3.000000],[4.000000,5.000000,6.000000]]] diff --git a/test/test_files/tinysnb/function/cast.test b/test/test_files/tinysnb/function/cast.test index f1d3ee58da5..b7ab4adb01e 100644 --- a/test/test_files/tinysnb/function/cast.test +++ b/test/test_files/tinysnb/function/cast.test @@ -335,6 +335,26 @@ Hubert Blaine Wolfeschlegelsteinhausenbergerdorff [1] [10,11,12,3,4,5,6,7] +-LOG CastListOfIntsToList +-STATEMENT MATCH (p:person) RETURN cast(p.workedHours, "DOUBLE[]"), cast(p.workedHours, "FLOAT[]"), cast(p.workedHours, "INT128[]"), cast(p.workedHours, "INT64[]"), cast(p.workedHours, "INT32[]"), cast(p.workedHours, "INT16[]"), cast(p.workedHours, "INT8[]"), cast(p.workedHours, "UINT8[]"), cast(p.workedHours, "UINT16[]"), cast(p.workedHours, "UINT32[]"), cast(p.workedHours, "UINT64[]"), cast(p.workedHours, "STRING[]") +---- 9 +[10.000000,5.000000]|[10.000000,5.000000]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5]|[10,5] +[12.000000,8.000000]|[12.000000,8.000000]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8]|[12,8] +[4.000000,5.000000]|[4.000000,5.000000]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5]|[4,5] +[1.000000,9.000000]|[1.000000,9.000000]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9]|[1,9] +[2.000000]|[2.000000]|[2]|[2]|[2]|[2]|[2]|[2]|[2]|[2]|[2]|[2] +[3.000000,4.000000,5.000000,6.000000,7.000000]|[3.000000,4.000000,5.000000,6.000000,7.000000]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7]|[3,4,5,6,7] +[1.000000]|[1.000000]|[1]|[1]|[1]|[1]|[1]|[1]|[1]|[1]|[1]|[1] +[10.000000,11.000000,12.000000,3.000000,4.000000,5.000000,6.000000,7.000000]|[10.000000,11.000000,12.000000,3.000000,4.000000,5.000000,6.000000,7.000000]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7]|[10,11,12,3,4,5,6,7] +||||||||||| +-STATEMENT MATCH (p:person) WHERE size(p.workedHours) > 1 RETURN cast(p.workedHours, "STRING[]") +---- 6 +[1,9] +[10,5] +[12,8] +[3,4,5,6,7] +[4,5] +[10,11,12,3,4,5,6,7] -LOG CastListOfListOfIntsToString -STATEMENT MATCH (p:person) RETURN string(p.courseScoresPerTerm) @@ -359,6 +379,28 @@ Hubert Blaine Wolfeschlegelsteinhausenbergerdorff [[10]] [[7],[10],[6,7]] +-LOG CastListOfListOfIntsToListOfLists +-STATEMENT MATCH (p:person) RETURN cast(p.courseScoresPerTerm, "INT128[][]"), cast(p.courseScoresPerTerm, "INT64[][]"), cast(p.courseScoresPerTerm, "INT32[][]"), cast(p.courseScoresPerTerm, "INT16[][]"), cast(p.courseScoresPerTerm, "INT8[][]"), cast(p.courseScoresPerTerm, "UINT8[][]"), cast(p.courseScoresPerTerm, "UINT16[][]"), cast(p.courseScoresPerTerm, "UINT32[][]"), cast(p.courseScoresPerTerm, "UINT64[][]"), cast(p.courseScoresPerTerm, "DOUBLE[][]"), cast(p.courseScoresPerTerm, "FLOAT[][]") +---- 9 +[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10,8],[6,7,8]]|[[10.000000,8.000000],[6.000000,7.000000,8.000000]]|[[10.000000,8.000000],[6.000000,7.000000,8.000000]] +[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8,9],[9,10]]|[[8.000000,9.000000],[9.000000,10.000000]]|[[8.000000,9.000000],[9.000000,10.000000]] +[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8,10]]|[[8.000000,10.000000]]|[[8.000000,10.000000]] +[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7,4],[8,8],[9]]|[[7.000000,4.000000],[8.000000,8.000000],[9.000000]]|[[7.000000,4.000000],[8.000000,8.000000],[9.000000]] +[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6],[7],[8]]|[[6.000000],[7.000000],[8.000000]]|[[6.000000],[7.000000],[8.000000]] +[[8]]|[[8]]|[[8]]|[[8]]|[[8]]|[[8]]|[[8]]|[[8]]|[[8]]|[[8.000000]]|[[8.000000]] +[[10]]|[[10]]|[[10]]|[[10]]|[[10]]|[[10]]|[[10]]|[[10]]|[[10]]|[[10.000000]]|[[10.000000]] +[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7],[10],[6,7]]|[[7.000000],[10.000000],[6.000000,7.000000]]|[[7.000000],[10.000000],[6.000000,7.000000]] +|||||||||| +-STATEMENT MATCH (p:person) WHERE size(p.courseScoresPerTerm) > 2 RETURN cast(p.courseScoresPerTerm, "STRING[]"); +---- 3 +[[7,4],[8,8],[9]] +[[6],[7],[8]] +[[7],[10],[6,7]] +-STATEMENT MATCH (p:person) WHERE size(p.courseScoresPerTerm) > 2 RETURN cast(cast(p.courseScoresPerTerm, "INT32[][]"), "UINT8[][]"); +---- 3 +[[7,4],[8,8],[9]] +[[6],[7],[8]] +[[7],[10],[6,7]] -LOG CastFixedListToString -STATEMENT MATCH (p:person) where p.ID > 1 RETURN string(p.grades) @@ -1083,15 +1125,6 @@ False -STATEMENT Return cast(cast(-15, "float"), "int128"), cast(cast(-1, "double"), "int128"), cast(cast(15, "float"), "int128"), cast(cast(1, "double"), "int128") ---- 1 -15|-1|15|1 - --LOG CastStringToFixedList --STATEMENT RETURN cast("[423, 321, 423]", "INT64[3]"), cast(null, "INT64[5]"), cast("[432.43214]", "FLOAT[1]"), cast("[4, -5]", "double[2]"), cast("[4234, 42312, 432, 1321]", "INT32[4]"), cast("[-32768]", "INT16[1]") ----- 1 -[423,321,423]||[432.432129]|[4.000000,-5.000000]|[4234,42312,432,1321]|[-32768] --STATEMENT Return cast(cast(-4324324, "int128"), "int64") ----- 1 --4324324 - -STATEMENT Return to_int64(to_int128(-4324324)) ---- 1 -4324324