Skip to content

Commit 790e320

Browse files
branch-4.1: [fix](exec) Return Thrift DATETIME as naive Arrow timestamp #67232 (#67299)
Cherry-picked from #67232 Co-authored-by: Mryange <yanxuecheng@selectdb.com>
1 parent b87c177 commit 790e320

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

be/src/exec/operator/memory_scratch_sink_operator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ Status MemoryScratchSinkOperatorX::sink_impl(RuntimeState* state, Block* input_b
107107
{
108108
SCOPED_TIMER(local_state._get_arrow_schema_timer);
109109
// After expr executed, use recaculated schema as final schema
110-
RETURN_IF_ERROR(get_arrow_schema_from_block(block, &block_arrow_schema, state->timezone()));
110+
RETURN_IF_ERROR(get_arrow_schema_from_block(block, &block_arrow_schema, state->timezone(),
111+
/*datetime_naive=*/true));
111112
}
112113
{
113114
SCOPED_TIMER(local_state._convert_block_to_arrow_batch_timer);

be/src/format/arrow/arrow_row_batch.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,12 @@ std::shared_ptr<arrow::Field> create_arrow_field_with_metadata(
203203
}
204204

205205
Status get_arrow_schema_from_block(const Block& block, std::shared_ptr<arrow::Schema>* result,
206-
const std::string& timezone) {
206+
const std::string& timezone, bool datetime_naive) {
207207
std::vector<std::shared_ptr<arrow::Field>> fields;
208208
for (const auto& type_and_name : block) {
209209
std::shared_ptr<arrow::DataType> arrow_type;
210-
RETURN_IF_ERROR(convert_to_arrow_type(type_and_name.type, &arrow_type, timezone));
210+
RETURN_IF_ERROR(
211+
convert_to_arrow_type(type_and_name.type, &arrow_type, timezone, datetime_naive));
211212
auto field = create_arrow_field_with_metadata(type_and_name.name, arrow_type,
212213
type_and_name.type->is_nullable(),
213214
type_and_name.type->get_primitive_type());

be/src/format/arrow/arrow_row_batch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ std::shared_ptr<arrow::Field> create_arrow_field_with_metadata(
5454
bool is_nullable, PrimitiveType primitive_type);
5555

5656
Status get_arrow_schema_from_block(const Block& block, std::shared_ptr<arrow::Schema>* result,
57-
const std::string& timezone);
57+
const std::string& timezone, bool datetime_naive = false);
5858

5959
Status get_arrow_schema_from_expr_ctxs(const VExprContextSPtrs& output_vexpr_ctxs,
6060
std::shared_ptr<arrow::Schema>* result,

0 commit comments

Comments
 (0)