This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 abb2048d5d [performance](executor) remove repeated call within the
loop in validate_column
abb2048d5d is described below
commit abb2048d5debbebcaa399e1c88a5b92fa4dc2108
Author: Mryange <[email protected]>
AuthorDate: Fri Jun 9 19:59:25 2023 +0800
[performance](executor) remove repeated call within the loop in
validate_column
---
be/src/vec/sink/vtablet_sink.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/be/src/vec/sink/vtablet_sink.cpp b/be/src/vec/sink/vtablet_sink.cpp
index ba8cf21fc7..bcb7dd2526 100644
--- a/be/src/vec/sink/vtablet_sink.cpp
+++ b/be/src/vec/sink/vtablet_sink.cpp
@@ -1689,7 +1689,8 @@ Status VOlapTableSink::_validate_column(RuntimeState*
state, const TypeDescripto
auto column_decimal =
const_cast<vectorized::ColumnDecimal<vectorized::Decimal128>*>(
assert_cast<const
vectorized::ColumnDecimal<vectorized::Decimal128>*>(
real_column_ptr.get()));
-
+ const auto& max_decimalv2 = _get_decimalv2_min_or_max<false>(type);
+ const auto& min_decimalv2 = _get_decimalv2_min_or_max<true>(type);
for (size_t j = 0; j < column->size(); ++j) {
auto row = rows ? (*rows)[j] : j;
if (row == last_invalid_row) {
@@ -1710,8 +1711,6 @@ Status VOlapTableSink::_validate_column(RuntimeState*
state, const TypeDescripto
invalid = true;
}
}
- const auto& max_decimalv2 =
_get_decimalv2_min_or_max<false>(type);
- const auto& min_decimalv2 =
_get_decimalv2_min_or_max<true>(type);
if (dec_val > max_decimalv2 || dec_val < min_decimalv2) {
fmt::format_to(error_msg, "{}", "decimal value is not
valid for definition");
fmt::format_to(error_msg, ", value={}",
dec_val.to_string());
@@ -1735,6 +1734,8 @@ Status VOlapTableSink::_validate_column(RuntimeState*
state, const TypeDescripto
auto column_decimal =
const_cast<vectorized::ColumnDecimal<vectorized::ColumnDecimalType>*>( \
assert_cast<const
vectorized::ColumnDecimal<vectorized::ColumnDecimalType>*>( \
real_column_ptr.get()));
\
+ const auto& max_decimal =
_get_decimalv3_min_or_max<vectorized::DecimalType, false>(type); \
+ const auto& min_decimal =
_get_decimalv3_min_or_max<vectorized::DecimalType, true>(type); \
for (size_t j = 0; j < column->size(); ++j) {
\
auto row = rows ? (*rows)[j] : j;
\
if (row == last_invalid_row) {
\
@@ -1743,10 +1744,6 @@ Status VOlapTableSink::_validate_column(RuntimeState*
state, const TypeDescripto
if (need_to_validate(j, row)) {
\
auto dec_val = column_decimal->get_data()[j];
\
bool invalid = false;
\
- const auto& max_decimal =
\
- _get_decimalv3_min_or_max<vectorized::DecimalType,
false>(type); \
- const auto& min_decimal =
\
- _get_decimalv3_min_or_max<vectorized::DecimalType,
true>(type); \
if (dec_val > max_decimal || dec_val < min_decimal) {
\
fmt::format_to(error_msg, "{}", "decimal value is not valid
for definition"); \
fmt::format_to(error_msg, ", value={}", dec_val);
\
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]