Skip to content

Commit 910b741

Browse files
authored
[fix](exec) Return DATETIME as naive Arrow timestamp (#10492) (#66873)
Arrow Flight SQL exposed Doris DATETIME values as timezone-aware Arrow timestamps, causing clients to interpret wall-clock values as instants and apply unwanted timezone conversion. The result schema now represents DATETIME as a timezone-naive timestamp while preserving timezone-aware TIMESTAMPTZ behavior. Arrow conversion unit tests and Arrow Flight SQL regression coverage were added. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
1 parent a21b5f2 commit 910b741

7 files changed

Lines changed: 180 additions & 35 deletions

File tree

‎be/src/exec/operator/result_sink_operator.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ Status ResultSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info)
5757
std::shared_ptr<arrow::Schema> arrow_schema;
5858
if (p._sink_type == TResultSinkType::ARROW_FLIGHT_PROTOCOL) {
5959
RETURN_IF_ERROR(get_arrow_schema_from_expr_ctxs(_output_vexpr_ctxs, &arrow_schema,
60-
state->timezone()));
60+
state->timezone(),
61+
/*datetime_naive=*/true));
6162
}
6263
VLOG_DEBUG << "create sender in INIT with instance id " << fragment_instance_id;
6364
RETURN_IF_ERROR(state->exec_env()->result_mgr()->create_sender(
@@ -122,7 +123,8 @@ Status ResultSinkOperatorX::prepare(RuntimeState* state) {
122123
std::shared_ptr<arrow::Schema> arrow_schema;
123124
if (_sink_type == TResultSinkType::ARROW_FLIGHT_PROTOCOL) {
124125
RETURN_IF_ERROR(get_arrow_schema_from_expr_ctxs(_output_vexpr_ctxs, &arrow_schema,
125-
state->timezone()));
126+
state->timezone(),
127+
/*datetime_naive=*/true));
126128
}
127129
VLOG_DEBUG << "create sender in prepare with query id " << state->query_id();
128130
RETURN_IF_ERROR(state->exec_env()->result_mgr()->create_sender(

‎be/src/format/arrow/arrow_row_batch.cpp‎

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
namespace doris {
5050

5151
Status convert_to_arrow_type(const DataTypePtr& origin_type,
52-
std::shared_ptr<arrow::DataType>* result,
53-
const std::string& timezone) {
52+
std::shared_ptr<arrow::DataType>* result, const std::string& timezone,
53+
bool datetime_naive) {
5454
auto type = get_serialized_type(origin_type);
5555
switch (type->get_primitive_type()) {
5656
case TYPE_NULL:
@@ -97,17 +97,27 @@ Status convert_to_arrow_type(const DataTypePtr& origin_type,
9797
case TYPE_DATEV2:
9898
*result = std::make_shared<arrow::Date32Type>();
9999
break;
100-
// TODO: maybe need to distinguish TYPE_DATETIME and TYPE_TIMESTAMPTZ
101100
case TYPE_TIMESTAMPTZ:
102-
case TYPE_DATETIMEV2:
101+
case TYPE_DATETIMEV2: {
102+
arrow::TimeUnit::type time_unit;
103103
if (type->get_scale() > 3) {
104-
*result = std::make_shared<arrow::TimestampType>(arrow::TimeUnit::MICRO, timezone);
104+
time_unit = arrow::TimeUnit::MICRO;
105105
} else if (type->get_scale() > 0) {
106-
*result = std::make_shared<arrow::TimestampType>(arrow::TimeUnit::MILLI, timezone);
106+
time_unit = arrow::TimeUnit::MILLI;
107107
} else {
108-
*result = std::make_shared<arrow::TimestampType>(arrow::TimeUnit::SECOND, timezone);
108+
time_unit = arrow::TimeUnit::SECOND;
109+
}
110+
// Doris DATETIMEV2 represents a wall-clock value without a timezone. Arrow Flight
111+
// exposes it as a timezone-naive timestamp so clients do not interpret it as an instant.
112+
// This option only changes the DATETIMEV2 output schema. TIMESTAMPTZ remains timezone-aware,
113+
// and Arrow-to-Doris conversions are unaffected.
114+
if (type->get_primitive_type() == TYPE_DATETIMEV2 && datetime_naive) {
115+
*result = std::make_shared<arrow::TimestampType>(time_unit);
116+
} else {
117+
*result = std::make_shared<arrow::TimestampType>(time_unit, timezone);
109118
}
110119
break;
120+
}
111121
case TYPE_DECIMALV2:
112122
case TYPE_DECIMAL32:
113123
case TYPE_DECIMAL64:
@@ -123,16 +133,19 @@ Status convert_to_arrow_type(const DataTypePtr& origin_type,
123133
case TYPE_ARRAY: {
124134
const auto* type_arr = assert_cast<const DataTypeArray*>(remove_nullable(type).get());
125135
std::shared_ptr<arrow::DataType> item_type;
126-
RETURN_IF_ERROR(convert_to_arrow_type(type_arr->get_nested_type(), &item_type, timezone));
136+
RETURN_IF_ERROR(convert_to_arrow_type(type_arr->get_nested_type(), &item_type, timezone,
137+
datetime_naive));
127138
*result = std::make_shared<arrow::ListType>(item_type);
128139
break;
129140
}
130141
case TYPE_MAP: {
131142
const auto* type_map = assert_cast<const DataTypeMap*>(remove_nullable(type).get());
132143
std::shared_ptr<arrow::DataType> key_type;
133144
std::shared_ptr<arrow::DataType> val_type;
134-
RETURN_IF_ERROR(convert_to_arrow_type(type_map->get_key_type(), &key_type, timezone));
135-
RETURN_IF_ERROR(convert_to_arrow_type(type_map->get_value_type(), &val_type, timezone));
145+
RETURN_IF_ERROR(convert_to_arrow_type(type_map->get_key_type(), &key_type, timezone,
146+
datetime_naive));
147+
RETURN_IF_ERROR(convert_to_arrow_type(type_map->get_value_type(), &val_type, timezone,
148+
datetime_naive));
136149
*result = std::make_shared<arrow::MapType>(key_type, val_type);
137150
break;
138151
}
@@ -141,8 +154,8 @@ Status convert_to_arrow_type(const DataTypePtr& origin_type,
141154
std::vector<std::shared_ptr<arrow::Field>> fields;
142155
for (size_t i = 0; i < type_struct->get_elements().size(); i++) {
143156
std::shared_ptr<arrow::DataType> field_type;
144-
RETURN_IF_ERROR(
145-
convert_to_arrow_type(type_struct->get_element(i), &field_type, timezone));
157+
RETURN_IF_ERROR(convert_to_arrow_type(type_struct->get_element(i), &field_type,
158+
timezone, datetime_naive));
146159
fields.push_back(
147160
std::make_shared<arrow::Field>(type_struct->get_element_name(i), field_type,
148161
type_struct->get_element(i)->is_nullable()));
@@ -206,12 +219,13 @@ Status get_arrow_schema_from_block(const Block& block, std::shared_ptr<arrow::Sc
206219

207220
Status get_arrow_schema_from_expr_ctxs(const VExprContextSPtrs& output_vexpr_ctxs,
208221
std::shared_ptr<arrow::Schema>* result,
209-
const std::string& timezone) {
222+
const std::string& timezone, bool datetime_naive) {
210223
std::vector<std::shared_ptr<arrow::Field>> fields;
211224
for (int i = 0; i < output_vexpr_ctxs.size(); i++) {
212225
std::shared_ptr<arrow::DataType> arrow_type;
213226
auto root_expr = output_vexpr_ctxs.at(i)->root();
214-
RETURN_IF_ERROR(convert_to_arrow_type(root_expr->data_type(), &arrow_type, timezone));
227+
RETURN_IF_ERROR(convert_to_arrow_type(root_expr->data_type(), &arrow_type, timezone,
228+
datetime_naive));
215229
auto field_name = root_expr->is_slot_ref() && !root_expr->expr_label().empty()
216230
? root_expr->expr_label()
217231
: fmt::format("{}_{}", root_expr->data_type()->get_name(), i);

‎be/src/format/arrow/arrow_row_batch.h‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ constexpr size_t MAX_ARROW_UTF8 = (1ULL << 31); // 2G
4343

4444
class RowDescriptor;
4545

46+
// datetime_naive only controls how Doris DATETIMEV2 is represented in the output Arrow schema.
47+
// When enabled, DATETIMEV2 is mapped to a timestamp without a timezone to preserve its wall-clock
48+
// semantics. TIMESTAMPTZ remains timezone-aware, and Arrow-to-Doris conversions are unaffected.
4649
Status convert_to_arrow_type(const DataTypePtr& type, std::shared_ptr<arrow::DataType>* result,
47-
const std::string& timezone);
50+
const std::string& timezone, bool datetime_naive = false);
4851

4952
std::shared_ptr<arrow::Field> create_arrow_field_with_metadata(
5053
const std::string& field_name, const std::shared_ptr<arrow::DataType>& arrow_type,
@@ -55,7 +58,7 @@ Status get_arrow_schema_from_block(const Block& block, std::shared_ptr<arrow::Sc
5558

5659
Status get_arrow_schema_from_expr_ctxs(const VExprContextSPtrs& output_vexpr_ctxs,
5760
std::shared_ptr<arrow::Schema>* result,
58-
const std::string& timezone);
61+
const std::string& timezone, bool datetime_naive = false);
5962

6063
Status serialize_record_batch(const arrow::RecordBatch& record_batch, std::string* result);
6164

‎be/test/core/data_type_serde/data_type_serde_arrow_test.cpp‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <gtest/gtest-test-part.h>
3737
#include <gtest/gtest.h>
3838

39+
#include <chrono>
3940
#include <cmath>
4041
#include <cstdint>
4142
#include <cstring>
@@ -70,6 +71,7 @@
7071
#include "core/data_type/data_type_quantilestate.h"
7172
#include "core/data_type/data_type_string.h"
7273
#include "core/data_type/data_type_struct.h"
74+
#include "core/data_type/data_type_timestamptz.h"
7375
#include "core/data_type/define_primitive_type.h"
7476
#include "core/field.h"
7577
#include "core/types.h"
@@ -654,4 +656,77 @@ TEST(DataTypeSerDeArrowTest, BlockConverterTest) {
654656
block_converter_test(cols, 7, false);
655657
}
656658

659+
TEST(DataTypeSerDeArrowTest, ConvertDateTimeV2ToNaiveArrowType) {
660+
const auto datetime_type = std::make_shared<DataTypeDateTimeV2>(6);
661+
std::shared_ptr<arrow::DataType> arrow_type;
662+
663+
auto status = convert_to_arrow_type(datetime_type, &arrow_type, "Asia/Shanghai");
664+
ASSERT_TRUE(status.ok()) << status;
665+
auto timestamp_type = std::static_pointer_cast<arrow::TimestampType>(arrow_type);
666+
EXPECT_EQ(arrow::TimeUnit::MICRO, timestamp_type->unit());
667+
EXPECT_EQ("Asia/Shanghai", timestamp_type->timezone());
668+
669+
status = convert_to_arrow_type(datetime_type, &arrow_type, "Asia/Shanghai", true);
670+
ASSERT_TRUE(status.ok()) << status;
671+
timestamp_type = std::static_pointer_cast<arrow::TimestampType>(arrow_type);
672+
EXPECT_EQ(arrow::TimeUnit::MICRO, timestamp_type->unit());
673+
EXPECT_TRUE(timestamp_type->timezone().empty());
674+
675+
const auto timestamptz_type = std::make_shared<DataTypeTimeStampTz>(6);
676+
status = convert_to_arrow_type(timestamptz_type, &arrow_type, "Asia/Shanghai", true);
677+
ASSERT_TRUE(status.ok()) << status;
678+
timestamp_type = std::static_pointer_cast<arrow::TimestampType>(arrow_type);
679+
EXPECT_EQ(arrow::TimeUnit::MICRO, timestamp_type->unit());
680+
EXPECT_EQ("Asia/Shanghai", timestamp_type->timezone());
681+
682+
const auto array_type = std::make_shared<DataTypeArray>(datetime_type);
683+
status = convert_to_arrow_type(array_type, &arrow_type, "Asia/Shanghai", true);
684+
ASSERT_TRUE(status.ok()) << status;
685+
const auto list_type = std::static_pointer_cast<arrow::ListType>(arrow_type);
686+
timestamp_type = std::static_pointer_cast<arrow::TimestampType>(list_type->value_type());
687+
EXPECT_TRUE(timestamp_type->timezone().empty());
688+
}
689+
690+
TEST(DataTypeSerDeArrowTest, DateTimeV2ArrowEncodingFollowsSchemaTimezone) {
691+
auto datetime_column = ColumnVector<TYPE_DATETIMEV2>::create();
692+
DateV2Value<DateTimeV2ValueType> datetime_value;
693+
datetime_value.unchecked_set_time(2026, 7, 2, 15, 0, 0, 123456);
694+
datetime_column->insert(Field::create_field<TYPE_DATETIMEV2>(datetime_value));
695+
696+
auto datetime_type = std::make_shared<DataTypeDateTimeV2>(6);
697+
Block block;
698+
block.insert(ColumnWithTypeAndName(datetime_column->get_ptr(), datetime_type, "ts"));
699+
700+
const auto utc_plus_eight = cctz::fixed_time_zone(std::chrono::hours(8));
701+
auto timezone_schema = arrow::schema(
702+
{arrow::field("ts", arrow::timestamp(arrow::TimeUnit::MICRO, "+08:00"), false)});
703+
std::shared_ptr<arrow::RecordBatch> timezone_batch;
704+
auto status = convert_to_arrow_batch(block, timezone_schema, arrow::default_memory_pool(),
705+
&timezone_batch, utc_plus_eight);
706+
ASSERT_TRUE(status.ok()) << status;
707+
708+
const auto timezone_type = std::static_pointer_cast<arrow::TimestampType>(
709+
timezone_batch->schema()->field(0)->type());
710+
EXPECT_EQ("+08:00", timezone_type->timezone());
711+
const auto timezone_array =
712+
std::static_pointer_cast<arrow::TimestampArray>(timezone_batch->column(0));
713+
// 2026-07-02 15:00:00.123456+08:00 is 2026-07-02 07:00:00.123456 UTC.
714+
EXPECT_EQ(1782975600123456, timezone_array->Value(0));
715+
716+
auto naive_schema =
717+
arrow::schema({arrow::field("ts", arrow::timestamp(arrow::TimeUnit::MICRO), false)});
718+
std::shared_ptr<arrow::RecordBatch> naive_batch;
719+
status = convert_to_arrow_batch(block, naive_schema, arrow::default_memory_pool(), &naive_batch,
720+
utc_plus_eight);
721+
ASSERT_TRUE(status.ok()) << status;
722+
723+
const auto naive_type =
724+
std::static_pointer_cast<arrow::TimestampType>(naive_batch->schema()->field(0)->type());
725+
EXPECT_TRUE(naive_type->timezone().empty());
726+
const auto naive_array =
727+
std::static_pointer_cast<arrow::TimestampArray>(naive_batch->column(0));
728+
// A timezone-naive Arrow timestamp preserves the 15:00:00.123456 wall-clock value.
729+
EXPECT_EQ(1783004400123456, naive_array->Value(0));
730+
}
731+
657732
} // namespace doris

‎fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/FlightSqlSchemaHelper.java‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.apache.doris.thrift.TListTableStatusResult;
3434
import org.apache.doris.thrift.TTableStatus;
3535

36-
import org.apache.arrow.adapter.jdbc.JdbcToArrowUtils;
3736
import org.apache.arrow.flight.sql.FlightSqlColumnMetadata;
3837
import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetDbSchemas;
3938
import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetTables;
@@ -92,8 +91,7 @@ public FlightSqlSchemaHelper(ConnectContext context) {
9291
* Ref: `convert_to_arrow_type` in be/src/util/arrow/row_batch.cpp.
9392
* which is consistent with the type of Arrow data returned by Doris Arrow Flight Sql query.
9493
*/
95-
private static ArrowType getArrowType(PrimitiveType primitiveType, Integer precision, Integer scale,
96-
String timeZone) {
94+
private static ArrowType getArrowType(PrimitiveType primitiveType, Integer precision, Integer scale) {
9795
switch (primitiveType) {
9896
case BOOLEAN:
9997
return new ArrowType.Bool();
@@ -128,11 +126,11 @@ private static ArrowType getArrowType(PrimitiveType primitiveType, Integer preci
128126
return new ArrowType.Date(DateUnit.DAY);
129127
case DATETIMEV2:
130128
if (scale > 3) {
131-
return new ArrowType.Timestamp(TimeUnit.MICROSECOND, timeZone);
129+
return new ArrowType.Timestamp(TimeUnit.MICROSECOND, null);
132130
} else if (scale > 0) {
133-
return new ArrowType.Timestamp(TimeUnit.MILLISECOND, timeZone);
131+
return new ArrowType.Timestamp(TimeUnit.MILLISECOND, null);
134132
} else {
135-
return new ArrowType.Timestamp(TimeUnit.SECOND, timeZone);
133+
return new ArrowType.Timestamp(TimeUnit.SECOND, null);
136134
}
137135
case TIMESTAMPTZ:
138136
if (scale > 3) {
@@ -169,9 +167,7 @@ private static ArrowType columnDescToArrowType(final TColumnDesc desc) {
169167
PrimitiveType primitiveType = PrimitiveType.fromThrift(desc.getColumnType());
170168
Integer precision = desc.isSetColumnPrecision() ? desc.getColumnPrecision() : null;
171169
Integer scale = desc.isSetColumnScale() ? desc.getColumnScale() : null;
172-
// TODO there is no timezone in TColumnDesc, so use current timezone.
173-
String timeZone = JdbcToArrowUtils.getUtcCalendar().getTimeZone().getID();
174-
return getArrowType(primitiveType, precision, scale, timeZone);
170+
return getArrowType(primitiveType, precision, scale);
175171
}
176172

177173
private static Map<String, String> createFlightSqlColumnMetadata(final String dbName, final String tableName,

‎regression-test/data/arrow_flight_sql_p0/test_select.out‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
777 4
44

55
-- !arrow_flight_sql_datetime --
6-
333 plsql333 2024-07-21 12:00:00.123456 2024-07-21 12:00:00.0
7-
222 plsql222 2024-07-20 12:00:00.123456 2024-07-20 12:00:00.0
8-
111 plsql111 2024-07-19 12:00:00.123456 2024-07-19 12:00:00.0
6+
333 plsql333 2024-07-21 12:00:00.123456 2024-07-21 12:00:00
7+
222 plsql222 2024-07-20 12:00:00.123456 2024-07-20 12:00:00
8+
111 plsql111 2024-07-19 12:00:00.123456 2024-07-19 12:00:00
99

1010
-- !arrow_flight_sql_jsonb --
1111
1 {"k1":1,"k2":"v2"}

‎regression-test/suites/arrow_flight_sql_p0/test_select.groovy‎

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
import java.sql.Types
19+
import java.time.LocalDateTime
20+
1821
suite("test_select", "arrow_flight_sql") {
1922
def tableName = "test_select"
2023
sql "DROP TABLE IF EXISTS ${tableName}"
@@ -32,14 +35,66 @@ suite("test_select", "arrow_flight_sql") {
3235
tableName = "test_select_datetime"
3336
sql "DROP TABLE IF EXISTS ${tableName}"
3437
sql """
35-
create table ${tableName} (id int, name varchar(20), f_datetime_p datetime(6), f_datetime datetime) DUPLICATE key(`id`) distributed by hash (`id`) buckets 4
38+
create table ${tableName} (id int, name varchar(20), f_datetime_p datetime(6),
39+
f_datetime datetime, f_timestamptz timestamptz(6))
40+
DUPLICATE key(`id`) distributed by hash (`id`) buckets 4
3641
properties ("replication_num"="1");
3742
"""
38-
sql """INSERT INTO ${tableName} VALUES(111, "plsql111","2024-07-19 12:00:00.123456","2024-07-19 12:00:00")"""
39-
sql """INSERT INTO ${tableName} VALUES(222, "plsql222","2024-07-20 12:00:00.123456","2024-07-20 12:00:00")"""
40-
sql """INSERT INTO ${tableName} VALUES(333, "plsql333","2024-07-21 12:00:00.123456","2024-07-21 12:00:00")"""
43+
sql """INSERT INTO ${tableName} VALUES
44+
(111, "plsql111", "2024-07-19 12:00:00.123456", "2024-07-19 12:00:00",
45+
"2024-07-19 12:00:00.123456 +08:00"),
46+
(222, "plsql222", "2024-07-20 12:00:00.123456", "2024-07-20 12:00:00",
47+
"2024-07-20 12:00:00.123456 +08:00"),
48+
(333, "plsql333", "2024-07-21 12:00:00.123456", "2024-07-21 12:00:00",
49+
"2024-07-21 12:00:00.123456 +08:00")
50+
"""
51+
52+
// Arrow JDBC's untyped getObject() applies timezone conversion to a naive timestamp. Keep the
53+
// snapshot comparison textual and verify the timestamp schema and wall-clock values explicitly.
54+
qt_arrow_flight_sql_datetime """
55+
SELECT id, name, CAST(f_datetime_p AS STRING), CAST(f_datetime AS STRING)
56+
FROM ${tableName}
57+
ORDER BY id DESC
58+
"""
59+
60+
def discoveredColumnTypes = [:]
61+
context.getArrowFlightSqlConnection().getMetaData()
62+
.getColumns(null, context.dbName, tableName, null).withCloseable { columns ->
63+
while (columns.next()) {
64+
discoveredColumnTypes[columns.getString("COLUMN_NAME")] = columns.getInt("DATA_TYPE")
65+
}
66+
}
67+
assertEquals(Types.TIMESTAMP, discoveredColumnTypes["f_datetime_p"])
68+
assertEquals(Types.TIMESTAMP, discoveredColumnTypes["f_datetime"])
69+
assertEquals(Types.TIMESTAMP_WITH_TIMEZONE, discoveredColumnTypes["f_timestamptz"])
70+
71+
context.getArrowFlightSqlConnection().createStatement().withCloseable { statement ->
72+
statement.executeQuery("""
73+
USE ${context.dbName};
74+
SELECT
75+
CAST('2024-07-19 12:00:00' AS DATETIME(0)) AS datetime_s,
76+
CAST('2024-07-19 12:00:00.123' AS DATETIME(3)) AS datetime_ms,
77+
CAST('2024-07-19 12:00:00.123456' AS DATETIME(6)) AS datetime_us,
78+
CAST('2024-07-19 12:00:00.123456 +08:00' AS TIMESTAMPTZ(6)) AS timestamptz_us
79+
""").withCloseable { resultSet ->
80+
def metadata = resultSet.getMetaData()
81+
assertEquals(4, metadata.getColumnCount())
82+
for (int i = 1; i <= 3; i++) {
83+
assertEquals(Types.TIMESTAMP, metadata.getColumnType(i))
84+
assertEquals("TIMESTAMP", metadata.getColumnTypeName(i))
85+
}
86+
assertEquals(Types.TIMESTAMP_WITH_TIMEZONE, metadata.getColumnType(4))
87+
assertEquals("TIMESTAMP_WITH_TIMEZONE", metadata.getColumnTypeName(4))
4188

42-
qt_arrow_flight_sql_datetime "select * from ${tableName} order by id desc"
89+
assertTrue(resultSet.next())
90+
assertEquals(LocalDateTime.parse("2024-07-19T12:00:00"),
91+
resultSet.getObject(1, LocalDateTime.class))
92+
assertEquals(LocalDateTime.parse("2024-07-19T12:00:00.123"),
93+
resultSet.getObject(2, LocalDateTime.class))
94+
assertEquals(LocalDateTime.parse("2024-07-19T12:00:00.123456"),
95+
resultSet.getObject(3, LocalDateTime.class))
96+
}
97+
}
4398

4499
tableName = "test_select_jsonb"
45100
sql "DROP TABLE IF EXISTS ${tableName}"

0 commit comments

Comments
 (0)