This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b8621364d25 [FIX](serde)fix scale with decimalv2 in mysql writer which
get real scale #25190
b8621364d25 is described below
commit b8621364d254c6d1a16f93dee96e599cedd53e38
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 208f0a2fddf..bd372ffcbfe 100644
--- a/be/src/vec/sink/vmysql_result_writer.cpp
+++ b/be/src/vec/sink/vmysql_result_writer.cpp
@@ -139,7 +139,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]