This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 8c3105a774f6f28d5135e3c4726f736aae64f0ef Author: lihangyu <15605149...@163.com> AuthorDate: Thu Sep 5 21:26:17 2024 +0800 [enhance](variant) throw exception when field type is not supported in cast elimation (#40388) --- be/src/olap/tablet_reader.cpp | 5 +++++ regression-test/suites/variant_p0/load.groovy | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/be/src/olap/tablet_reader.cpp b/be/src/olap/tablet_reader.cpp index 5966feeaaf2..dcdd8819e3d 100644 --- a/be/src/olap/tablet_reader.cpp +++ b/be/src/olap/tablet_reader.cpp @@ -31,6 +31,7 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/config.h" +#include "common/exception.h" #include "common/logging.h" #include "common/status.h" #include "exprs/bitmapfilter_predicate.h" @@ -270,6 +271,10 @@ TabletColumn TabletReader::materialize_column(const TabletColumn& orig) { TabletColumn column_with_cast_type = orig; auto cast_type = _reader_context.target_cast_type_for_variants.at(orig.name()); FieldType filed_type = TabletColumn::get_field_type_by_type(cast_type.type); + if (filed_type == FieldType::OLAP_FIELD_TYPE_UNKNOWN) { + throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Invalid type for variant column: {}", + cast_type.type); + } column_with_cast_type.set_type(filed_type); return column_with_cast_type; } diff --git a/regression-test/suites/variant_p0/load.groovy b/regression-test/suites/variant_p0/load.groovy index d74155b182d..c4c10f0e012 100644 --- a/regression-test/suites/variant_p0/load.groovy +++ b/regression-test/suites/variant_p0/load.groovy @@ -441,6 +441,11 @@ suite("regression_test_variant", "p0"){ sql """insert into var_as_key values(2, '{"b" : 11}')""" qt_sql "select * from var_as_key order by k" + test { + sql """select * from ghdata where cast(v['actor']['url'] as ipv4) = '127.0.0.1'""" + exception("Invalid type for variant column: 36") + } + } finally { // reset flags } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org