This is an automated email from the ASF dual-hosted git repository. dataroaring 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 184cee2d2b [Bug](outfile) Fix wrong decimal format for ORC (#14124) 184cee2d2b is described below commit 184cee2d2bf678a1ce82349111df6c8663b58edc Author: Gabriel <gabrielleeb...@gmail.com> AuthorDate: Thu Nov 10 11:01:30 2022 +0800 [Bug](outfile) Fix wrong decimal format for ORC (#14124) --- be/src/vec/runtime/vorc_writer.cpp | 10 +++++++--- .../src/main/java/org/apache/doris/analysis/OutFileClause.java | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/be/src/vec/runtime/vorc_writer.cpp b/be/src/vec/runtime/vorc_writer.cpp index 2ac738c799..64a0d60e7e 100644 --- a/be/src/vec/runtime/vorc_writer.cpp +++ b/be/src/vec/runtime/vorc_writer.cpp @@ -445,13 +445,17 @@ Status VOrcWriterWrapper::write(const Block& block) { cur_batch->notNull[row_id] = 1; auto& v = assert_cast<const ColumnDecimal128&>(*col).get_data()[row_id]; orc::Int128 value(v >> 64, (uint64_t)v); - cur_batch->values[row_id] += value; + cur_batch->values[row_id] = value; } } } else if (const auto& not_null_column = check_and_get_column<const ColumnDecimal128>(col)) { - memcpy(reinterpret_cast<void*>(cur_batch->values.data()), - not_null_column->get_data().data(), sz * sizeof(Int128)); + auto ptr = not_null_column->get_data().data(); + for (size_t row_id = 0; row_id < sz; row_id++) { + auto v = ptr[row_id]; + orc::Int128 value(v >> 64, (uint64_t)v); + cur_batch->values[row_id] = value; + } } else { RETURN_WRONG_TYPE } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java index 13df239766..2a1303b473 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java @@ -288,8 +288,7 @@ public class OutFileClause { break; case DECIMALV2: if (!expr.getType().isWildcardDecimal()) { - type = String.format("decimal(%d, %d)", ScalarType.MAX_DECIMAL128_PRECISION, - ((ScalarType) expr.getType()).decimalScale()); + type = String.format("decimal(%d, 9)", ScalarType.MAX_DECIMAL128_PRECISION); } else { throw new AnalysisException("currently ORC writer do not support WildcardDecimal!"); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org