summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorziganshinmr <[email protected]>2025-09-02 16:49:59 +0300
committerziganshinmr <[email protected]>2025-09-02 17:39:49 +0300
commit9830b9f327c9beec558cb2cbbcd894585295e09c (patch)
tree3594e60a824933a4859c190e986151987b52e894
parent7bdf035d349d1300c1c75124429efc1ba9694ddf (diff)
Fix Datetime type in Arrow decoder
commit_hash:1ccae1512b6610d16917bd46594c6fec22123872
-rw-r--r--yt/yql/providers/yt/codec/yt_arrow_converter.cpp13
-rw-r--r--yt/yql/tests/sql/suites/blocks/block_input_various_types_2.txt2
-rw-r--r--yt/yql/tests/sql/suites/blocks/block_input_various_types_2_v3.txt2
3 files changed, 7 insertions, 10 deletions
diff --git a/yt/yql/providers/yt/codec/yt_arrow_converter.cpp b/yt/yql/providers/yt/codec/yt_arrow_converter.cpp
index 52ce6e8cea3..2bd46b50bbd 100644
--- a/yt/yql/providers/yt/codec/yt_arrow_converter.cpp
+++ b/yt/yql/providers/yt/codec/yt_arrow_converter.cpp
@@ -991,15 +991,12 @@ std::unique_ptr<IYtColumnConverter> MakeYtColumnConverter(TType* type, const NUd
}
case NUdf::EDataSlot::Datetime:
if (nativeYtTypeFlags & NTCF_DATE) {
- // YT arrow type is arrow::date64 - milliseconds since epoch (int64 underlying)
- // YQL arrow type is arrow::uint32 - seconds since epoch
- //
- // Additional cast to arrow::timestamp(second) (int64 underlying) is required
- // to convert milliseconds to seconds
- return CreateArrowNativeColumnConverter<TCastAndBoundCheckConverter<arrow::Type::DATE64, uint32_t>>(
+ // YT arrow type is arrow::timestamp (int64 underlying) (seconds are expected)
+ // YQL arrow type is arrow::uint32
+ return CreateArrowNativeColumnConverter<TCastAndBoundCheckConverter<arrow::Type::TIMESTAMP, uint32_t>>(
std::move(settings),
- arrow::date64(),
- std::vector {arrow::timestamp(arrow::TimeUnit::SECOND), arrow::int64()},
+ arrow::timestamp(arrow::TimeUnit::SECOND),
+ arrow::int64(),
NUdf::MAX_DATETIME, false
);
} else {
diff --git a/yt/yql/tests/sql/suites/blocks/block_input_various_types_2.txt b/yt/yql/tests/sql/suites/blocks/block_input_various_types_2.txt
index a20a0ba73e5..3f1510740f6 100644
--- a/yt/yql/tests/sql/suites/blocks/block_input_various_types_2.txt
+++ b/yt/yql/tests/sql/suites/blocks/block_input_various_types_2.txt
@@ -1,2 +1,2 @@
-{"Date"=18155u;"DateTime"=1568592000u;"DoubleOptionalDate"=[18155u;];"DoubleOptionalDateTime"=[1568592000u;];"DoubleOptionalFloat"=[12.199999809265137;];"DoubleOptionalInterval"=[1000000000000;];"DoubleOptionalTimestamp"=[1568592000000000u;];"Float"=12.199999809265137;"Interval"=1000000000000;"OptionalDate"=18155u;"OptionalDateTime"=1568592000u;"OptionalFloat"=12.199999809265137;"OptionalInterval"=1000000000000;"OptionalTimestamp"=1568592000000000u;"Timestamp"=1568592000000000u;};
+{"Date"=18155u;"DateTime"=1568592001u;"DoubleOptionalDate"=[18155u;];"DoubleOptionalDateTime"=[1568592001u;];"DoubleOptionalFloat"=[12.199999809265137;];"DoubleOptionalInterval"=[1000000000000;];"DoubleOptionalTimestamp"=[1568592000000000u;];"Float"=12.199999809265137;"Interval"=1000000000000;"OptionalDate"=18155u;"OptionalDateTime"=1568592001u;"OptionalFloat"=12.199999809265137;"OptionalInterval"=1000000000000;"OptionalTimestamp"=1568592000000000u;"Timestamp"=1568592000000000u;};
{"Date"=18521u;"DateTime"=1600214400u;"DoubleOptionalDate"=[18521u;];"DoubleOptionalDateTime"=[1600214400u;];"DoubleOptionalFloat"=[13.5;];"DoubleOptionalInterval"=[1500000000000;];"DoubleOptionalTimestamp"=[1600214400000000u;];"Float"=13.5;"Interval"=1500000000000;"OptionalDate"=18521u;"OptionalDateTime"=1600214400u;"OptionalFloat"=13.5;"OptionalInterval"=1500000000000;"OptionalTimestamp"=1600214400000000u;"Timestamp"=1600214400000000u;};
diff --git a/yt/yql/tests/sql/suites/blocks/block_input_various_types_2_v3.txt b/yt/yql/tests/sql/suites/blocks/block_input_various_types_2_v3.txt
index a20a0ba73e5..3f1510740f6 100644
--- a/yt/yql/tests/sql/suites/blocks/block_input_various_types_2_v3.txt
+++ b/yt/yql/tests/sql/suites/blocks/block_input_various_types_2_v3.txt
@@ -1,2 +1,2 @@
-{"Date"=18155u;"DateTime"=1568592000u;"DoubleOptionalDate"=[18155u;];"DoubleOptionalDateTime"=[1568592000u;];"DoubleOptionalFloat"=[12.199999809265137;];"DoubleOptionalInterval"=[1000000000000;];"DoubleOptionalTimestamp"=[1568592000000000u;];"Float"=12.199999809265137;"Interval"=1000000000000;"OptionalDate"=18155u;"OptionalDateTime"=1568592000u;"OptionalFloat"=12.199999809265137;"OptionalInterval"=1000000000000;"OptionalTimestamp"=1568592000000000u;"Timestamp"=1568592000000000u;};
+{"Date"=18155u;"DateTime"=1568592001u;"DoubleOptionalDate"=[18155u;];"DoubleOptionalDateTime"=[1568592001u;];"DoubleOptionalFloat"=[12.199999809265137;];"DoubleOptionalInterval"=[1000000000000;];"DoubleOptionalTimestamp"=[1568592000000000u;];"Float"=12.199999809265137;"Interval"=1000000000000;"OptionalDate"=18155u;"OptionalDateTime"=1568592001u;"OptionalFloat"=12.199999809265137;"OptionalInterval"=1000000000000;"OptionalTimestamp"=1568592000000000u;"Timestamp"=1568592000000000u;};
{"Date"=18521u;"DateTime"=1600214400u;"DoubleOptionalDate"=[18521u;];"DoubleOptionalDateTime"=[1600214400u;];"DoubleOptionalFloat"=[13.5;];"DoubleOptionalInterval"=[1500000000000;];"DoubleOptionalTimestamp"=[1600214400000000u;];"Float"=13.5;"Interval"=1500000000000;"OptionalDate"=18521u;"OptionalDateTime"=1600214400u;"OptionalFloat"=13.5;"OptionalInterval"=1500000000000;"OptionalTimestamp"=1600214400000000u;"Timestamp"=1600214400000000u;};