This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit d980ca68c8f39a3c5c14110786f453e2846102d5 Author: amory <[email protected]> AuthorDate: Tue Oct 10 09:09:57 2023 +0800 [FIX](serde)fix scale with decimalv2 in mysql writer which get real scale #25190 --- be/src/vec/sink/vmysql_result_writer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/be/src/vec/sink/vmysql_result_writer.cpp b/be/src/vec/sink/vmysql_result_writer.cpp index 79bc099246e..f1094673b0f 100644 --- a/be/src/vec/sink/vmysql_result_writer.cpp +++ b/be/src/vec/sink/vmysql_result_writer.cpp @@ -632,7 +632,15 @@ Status VMysqlResultWriter<is_binary_format>::append_block(Block& input_block) { std::vector<Arguments> arguments; for (int i = 0; i < _output_vexpr_ctxs.size(); ++i) { const auto& [column_ptr, col_const] = unpack_if_const(block.get_by_position(i).column); - auto serde = block.get_by_position(i).type->get_serde(); + int scale = _output_vexpr_ctxs[i]->root()->type().scale; + // decimalv2 scale and precision is hard code, so we should get real scale and precision + // from expr + DataTypeSerDeSPtr serde; + if (_output_vexpr_ctxs[i]->root()->type().is_decimal_v2_type()) { + serde = std::make_shared<DataTypeDecimalSerDe<vectorized::Decimal128>>(scale, 27); + } else { + serde = block.get_by_position(i).type->get_serde(); + } serde->set_return_object_as_string(output_object_data()); arguments.emplace_back(column_ptr.get(), col_const, serde); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
