github-actions[bot] commented on code in PR #62179:
URL: https://github.com/apache/doris/pull/62179#discussion_r3084701391
##########
be/test/core/data_type_serde/data_type_serde_number_test.cpp:
##########
@@ -336,4 +338,38 @@ TEST_F(DataTypeNumberSerDeTest, ArrowMemNotAligned) {
EXPECT_TRUE(st.ok());
}
+TEST_F(DataTypeNumberSerDeTest, ArrowStringToUnsignedDateLikeTypes) {
+ std::vector<std::string> strings = {"20240102", "20240102112233"};
+ std::vector<int32_t> offsets = {0};
+ int32_t total_length = 0;
+ for (const auto& str : strings) {
+ total_length += static_cast<int32_t>(str.length());
+ offsets.push_back(total_length);
+ }
+
+ std::string value_bytes;
+ value_bytes.reserve(total_length);
+ for (const auto& str : strings) {
+ value_bytes.append(str);
+ }
+
+ auto value_buffer = arrow::Buffer::Wrap(value_bytes.data(),
value_bytes.size());
+ auto offset_buffer = arrow::Buffer::Wrap(offsets);
+ auto arr = std::make_shared<arrow::StringArray>(strings.size(),
offset_buffer, value_buffer);
+
+ auto datev2_column = ColumnVector<TYPE_DATEV2>::create();
+ auto datetimev2_column = ColumnVector<TYPE_DATETIMEV2>::create();
+ cctz::time_zone tz;
+
+ auto st = serde_datev2_num->read_column_from_arrow(*datev2_column,
arr.get(), 0, 1, tz);
+ ASSERT_TRUE(st.ok());
+ ASSERT_EQ(1, datev2_column->size());
+ EXPECT_EQ(20240102U, datev2_column->get_data()[0].to_date_int_val());
Review Comment:
`to_date_int_val()` is the packed internal encoding for `DateV2` /
`DateTimeV2`, not the human-readable `YYYYMMDD` / `YYYYMMDDhhmmss` digits.
Existing canonical tests in `be/test/core/value/vdatetime_value_test.cpp`
already document that packed layout (`year << 9 | month << 5 | day` for date,
and bit-packed fields for datetime).
Because of that, this test is not actually validating the new Arrow STRING
parsing path correctly. Please either:
- assert via `to_string()` / year-month-day-hour-minute-second accessors, or
- compare against the packed representation explicitly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]