diff options
author | vvvv <vvvv@ydb.tech> | 2022-11-15 16:46:02 +0300 |
---|---|---|
committer | vvvv <vvvv@ydb.tech> | 2022-11-15 16:46:02 +0300 |
commit | 3d7181a331668643d91bb422a22c07d8f3a7c33e (patch) | |
tree | eae2e6e806481f5669e71b07a94bf4ecffcf954d | |
parent | fa61b027a9cd9d42d5ffb122c59d2df33a6a5a47 (diff) | |
download | ydb-3d7181a331668643d91bb422a22c07d8f3a7c33e.tar.gz |
initial support for Date,Datetime,Timestamp & Interval
5 files changed, 40 insertions, 0 deletions
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_minmax.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_minmax.cpp index 7ea95111ba..a0fde1f70d 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_minmax.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_minmax.cpp @@ -214,14 +214,18 @@ public: case NUdf::EDataSlot::Int16: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<i16, arrow::Int16Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<ui16, arrow::UInt16Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int32: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<i32, arrow::Int32Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<ui32, arrow::UInt32Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<i64, arrow::Int64Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TMinMaxBlockAggregatorNullableOrScalar<ui64, arrow::UInt64Scalar, IsMin>>(filterColumn, argsColumns[0]); default: throw yexception() << "Unsupported MIN/MAX input type"; @@ -237,14 +241,18 @@ public: case NUdf::EDataSlot::Int16: return std::make_unique<TMinMaxBlockAggregator<i16, arrow::Int16Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TMinMaxBlockAggregator<ui16, arrow::UInt16Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int32: return std::make_unique<TMinMaxBlockAggregator<i32, arrow::Int32Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TMinMaxBlockAggregator<ui32, arrow::UInt32Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TMinMaxBlockAggregator<i64, arrow::Int64Scalar, IsMin>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TMinMaxBlockAggregator<ui64, arrow::UInt64Scalar, IsMin>>(filterColumn, argsColumns[0]); default: throw yexception() << "Unsupported MIN/MAX input type"; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp index 5b14c7df34..2fe4f0d0d1 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp @@ -191,14 +191,18 @@ public: case NUdf::EDataSlot::Int16: return std::make_unique<TSumBlockAggregatorNullableOrScalar<i16, i64, arrow::Int16Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TSumBlockAggregatorNullableOrScalar<ui16, ui64, arrow::UInt16Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int32: return std::make_unique<TSumBlockAggregatorNullableOrScalar<i32, i64, arrow::Int32Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TSumBlockAggregatorNullableOrScalar<ui32, ui64, arrow::UInt32Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TSumBlockAggregatorNullableOrScalar<i64, i64, arrow::Int64Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TSumBlockAggregatorNullableOrScalar<ui64, ui64, arrow::UInt64Scalar>>(filterColumn, argsColumns[0]); default: throw yexception() << "Unsupported SUM input type"; @@ -212,14 +216,18 @@ public: case NUdf::EDataSlot::Int16: return std::make_unique<TSumBlockAggregator<i16, i64, arrow::Int16Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TSumBlockAggregator<ui16, ui64, arrow::UInt16Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int32: return std::make_unique<TSumBlockAggregator<i32, i64, arrow::Int32Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TSumBlockAggregator<ui32, ui64, arrow::UInt32Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TSumBlockAggregator<i64, i64, arrow::Int64Scalar>>(filterColumn, argsColumns[0]); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TSumBlockAggregator<ui64, ui64, arrow::UInt64Scalar>>(filterColumn, argsColumns[0]); default: throw yexception() << "Unsupported SUM input type"; @@ -246,14 +254,18 @@ public: case NUdf::EDataSlot::Int16: return std::make_unique<TAvgBlockAggregator<i16, arrow::Int16Scalar>>(filterColumn, argsColumns[0], holderFactory); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TAvgBlockAggregator<ui16, arrow::UInt16Scalar>>(filterColumn, argsColumns[0], holderFactory); case NUdf::EDataSlot::Int32: return std::make_unique<TAvgBlockAggregator<i32, arrow::Int32Scalar>>(filterColumn, argsColumns[0], holderFactory); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TAvgBlockAggregator<ui32, arrow::UInt32Scalar>>(filterColumn, argsColumns[0], holderFactory); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TAvgBlockAggregator<i64, arrow::Int64Scalar>>(filterColumn, argsColumns[0], holderFactory); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TAvgBlockAggregator<ui64, arrow::UInt64Scalar>>(filterColumn, argsColumns[0], holderFactory); default: throw yexception() << "Unsupported AVG input type"; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_block_compress.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_block_compress.cpp index 933963e3c3..8fa6a88a9a 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_block_compress.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_block_compress.cpp @@ -398,14 +398,18 @@ private: case NUdf::EDataSlot::Int16: CompressArray(src->GetValues<i16>(1), bitmapData, bitmapOffset, (i16*)mutDstBase + dstPos, length); break; case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: CompressArray(src->GetValues<ui16>(1), bitmapData, bitmapOffset, (ui16*)mutDstBase + dstPos, length); break; case NUdf::EDataSlot::Int32: CompressArray(src->GetValues<i32>(1), bitmapData, bitmapOffset, (i32*)mutDstBase + dstPos, length); break; case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: CompressArray(src->GetValues<ui32>(1), bitmapData, bitmapOffset, (ui32*)mutDstBase + dstPos, length); break; case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: CompressArray(src->GetValues<i64>(1), bitmapData, bitmapOffset, (i64*)mutDstBase + dstPos, length); break; case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: CompressArray(src->GetValues<ui64>(1), bitmapData, bitmapOffset, (ui64*)mutDstBase + dstPos, length); break; default: MKQL_ENSURE(false, "Unsupported data slot"); diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_blocks.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_blocks.cpp index ae9f7406dd..e0089a9188 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_blocks.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_blocks.cpp @@ -99,14 +99,18 @@ std::unique_ptr<TBlockBuilderBase> MakeBlockBuilder(TComputationContext& ctx, NU case NUdf::EDataSlot::Int16: return std::make_unique<TFixedSizeBlockBuilder<i16, arrow::Int16Builder>>(ctx, arrow::int16()); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TFixedSizeBlockBuilder<ui16, arrow::UInt16Builder>>(ctx, arrow::uint16()); case NUdf::EDataSlot::Int32: return std::make_unique<TFixedSizeBlockBuilder<i32, arrow::Int32Builder>>(ctx, arrow::int32()); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TFixedSizeBlockBuilder<ui32, arrow::UInt32Builder>>(ctx, arrow::uint32()); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TFixedSizeBlockBuilder<i64, arrow::Int64Builder>>(ctx, arrow::int64()); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TFixedSizeBlockBuilder<ui64, arrow::UInt64Builder>>(ctx, arrow::uint64()); default: MKQL_ENSURE(false, "Unsupported data slot"); @@ -290,14 +294,18 @@ std::unique_ptr<TBlockReaderBase> MakeBlockReader(NUdf::EDataSlot slot) { case NUdf::EDataSlot::Int16: return std::make_unique<TFixedSizeBlockReader<i16>>(); case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: return std::make_unique<TFixedSizeBlockReader<ui16>>(); case NUdf::EDataSlot::Int32: return std::make_unique<TFixedSizeBlockReader<i32>>(); case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: return std::make_unique<TFixedSizeBlockReader<ui32>>(); case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: return std::make_unique<TFixedSizeBlockReader<i64>>(); case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: return std::make_unique<TFixedSizeBlockReader<ui64>>(); default: MKQL_ENSURE(false, "Unsupported data slot"); @@ -531,18 +539,22 @@ public: result = arrow::Datum(static_cast<int16_t>(value.Get<i16>())); break; case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: result = arrow::Datum(static_cast<uint16_t>(value.Get<ui16>())); break; case NUdf::EDataSlot::Int32: result = arrow::Datum(static_cast<int32_t>(value.Get<i32>())); break; case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: result = arrow::Datum(static_cast<uint32_t>(value.Get<ui32>())); break; case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: result = arrow::Datum(static_cast<int64_t>(value.Get<i64>())); break; case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: result = arrow::Datum(static_cast<uint64_t>(value.Get<ui64>())); break; default: diff --git a/ydb/library/yql/minikql/mkql_type_builder.cpp b/ydb/library/yql/minikql/mkql_type_builder.cpp index 7304949836..04ec05bec4 100644 --- a/ydb/library/yql/minikql/mkql_type_builder.cpp +++ b/ydb/library/yql/minikql/mkql_type_builder.cpp @@ -1335,21 +1335,25 @@ bool ConvertArrowType(TType* itemType, bool& isOptional, std::shared_ptr<arrow:: type = arrow::int8(); return true; case NUdf::EDataSlot::Uint16: + case NUdf::EDataSlot::Date: type = arrow::uint16(); return true; case NUdf::EDataSlot::Int16: type = arrow::int16(); return true; case NUdf::EDataSlot::Uint32: + case NUdf::EDataSlot::Datetime: type = arrow::uint32(); return true; case NUdf::EDataSlot::Int32: type = arrow::int32(); return true; case NUdf::EDataSlot::Int64: + case NUdf::EDataSlot::Interval: type = arrow::int64(); return true; case NUdf::EDataSlot::Uint64: + case NUdf::EDataSlot::Timestamp: type = arrow::uint64(); return true; default: |