diff --git a/be/src/exprs/bloom_filter_func.h b/be/src/exprs/bloom_filter_func.h index 674a429581643b..ff749420ad286e 100644 --- a/be/src/exprs/bloom_filter_func.h +++ b/be/src/exprs/bloom_filter_func.h @@ -233,6 +233,8 @@ class BloomFilterFuncBase : public RuntimeFilterFuncBase { uint16_t* offsets, int number, bool is_parse_column) = 0; + bool inited() const { return _inited; } + private: void _limit_length() { if (_runtime_bloom_filter_min_size > 0) { diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp index 19789fbd743cbc..e26452c9ef69e5 100644 --- a/be/src/exprs/runtime_filter.cpp +++ b/be/src/exprs/runtime_filter.cpp @@ -1283,6 +1283,13 @@ PrimitiveType IRuntimeFilter::column_type() const { void IRuntimeFilter::signal() { DCHECK(is_consumer()); + + if (!_wrapper->is_ignored() && _wrapper->is_bloomfilter() && + !_wrapper->get_bloomfilter()->inited()) { + throw Exception(ErrorCode::INTERNAL_ERROR, "bf not inited and not ignored, rf: {}", + debug_string()); + } + COUNTER_SET(_wait_timer, int64_t((MonotonicMillis() - registration_time_) * NANOS_PER_MILLIS)); _rf_state_atomic.store(RuntimeFilterState::READY); if (!_filter_timer.empty()) { diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h index 593666568aa375..24653f878555f5 100644 --- a/be/src/vec/columns/column.h +++ b/be/src/vec/columns/column.h @@ -565,10 +565,6 @@ class IColumn : public COW { /// It's true for ColumnNullable, can be true or false for ColumnConst, etc. virtual bool is_concrete_nullable() const { return false; } - virtual bool is_bitmap() const { return false; } - - virtual bool is_hll() const { return false; } - // true if column has null element virtual bool has_null() const { return false; } @@ -607,10 +603,6 @@ class IColumn : public COW { /// Checks only @sample_ratio ratio of rows. virtual double get_ratio_of_default_rows(double sample_ratio = 1.0) const { return 0.0; } - /// Column is ColumnVector of numbers or ColumnConst of it. Note that Nullable columns are not numeric. - /// Implies is_fixed_and_contiguous. - virtual bool is_numeric() const { return false; } - // Column is ColumnString/ColumnArray/ColumnMap or other variable length column at every row virtual bool is_variable_length() const { return false; } @@ -618,8 +610,6 @@ class IColumn : public COW { virtual bool is_column_string64() const { return false; } - virtual bool is_column_decimal() const { return false; } - virtual bool is_column_dictionary() const { return false; } virtual bool is_column_array() const { return false; } @@ -752,4 +742,4 @@ struct ColumnPtrWrapper { ColumnPtrWrapper(vectorized::ColumnPtr col) : column_ptr(std::move(col)) {} }; -} // namespace doris +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/columns/column_complex.h b/be/src/vec/columns/column_complex.h index 14ae940c9d7ba0..f8513d54f57934 100644 --- a/be/src/vec/columns/column_complex.h +++ b/be/src/vec/columns/column_complex.h @@ -48,11 +48,6 @@ class ColumnComplexType final : public COWHelper> using value_type = T; using Container = std::vector; - bool is_numeric() const override { return false; } - - bool is_bitmap() const override { return std::is_same_v; } - bool is_hll() const override { return std::is_same_v; } - size_t size() const override { return data.size(); } StringRef get_data_at(size_t n) const override { diff --git a/be/src/vec/columns/column_const.h b/be/src/vec/columns/column_const.h index 69177eb2ca377a..80d50e26e16ead 100644 --- a/be/src/vec/columns/column_const.h +++ b/be/src/vec/columns/column_const.h @@ -253,7 +253,6 @@ class ColumnConst final : public COWHelper { // ColumnConst is not nullable, but may be concrete nullable. bool is_concrete_nullable() const override { return is_column_nullable(*data); } bool only_null() const override { return data->is_null_at(0); } - bool is_numeric() const override { return data->is_numeric(); } StringRef get_raw_data() const override { return data->get_raw_data(); } /// Not part of the common interface. diff --git a/be/src/vec/columns/column_decimal.h b/be/src/vec/columns/column_decimal.h index 946b268436ef6c..a8b1f9573ef185 100644 --- a/be/src/vec/columns/column_decimal.h +++ b/be/src/vec/columns/column_decimal.h @@ -105,9 +105,6 @@ class ColumnDecimal final : public COWHelper> { public: std::string get_name() const override { return TypeName::get(); } - bool is_numeric() const override { return false; } - bool is_column_decimal() const override { return true; } - size_t size() const override { return data.size(); } size_t byte_size() const override { return data.size() * sizeof(data[0]); } size_t allocated_bytes() const override { return data.allocated_bytes(); } diff --git a/be/src/vec/columns/column_nullable.h b/be/src/vec/columns/column_nullable.h index 83d5e6af35aeb4..84b3ce0f82aadb 100644 --- a/be/src/vec/columns/column_nullable.h +++ b/be/src/vec/columns/column_nullable.h @@ -328,9 +328,6 @@ class ColumnNullable final : public COWHelper, public N bool is_nullable() const override { return true; } bool is_concrete_nullable() const override { return true; } - bool is_bitmap() const override { return get_nested_column().is_bitmap(); } - bool is_hll() const override { return get_nested_column().is_hll(); } - bool is_column_decimal() const override { return get_nested_column().is_column_decimal(); } bool is_column_string() const override { return get_nested_column().is_column_string(); } bool is_column_array() const override { return get_nested_column().is_column_array(); } bool is_column_map() const override { return get_nested_column().is_column_map(); } diff --git a/be/src/vec/columns/column_vector.h b/be/src/vec/columns/column_vector.h index 970997a91864cc..8006d76c1f98be 100644 --- a/be/src/vec/columns/column_vector.h +++ b/be/src/vec/columns/column_vector.h @@ -152,8 +152,6 @@ class ColumnVector final : public COWHelper> { ColumnVector(std::initializer_list il) : data {il} {} public: - bool is_numeric() const override { return IsNumber; } - size_t size() const override { return data.size(); } StringRef get_data_at(size_t n) const override { diff --git a/be/src/vec/columns/predicate_column.h b/be/src/vec/columns/predicate_column.h index 7e15656fe1d204..ab9648c3ae620f 100644 --- a/be/src/vec/columns/predicate_column.h +++ b/be/src/vec/columns/predicate_column.h @@ -102,8 +102,6 @@ class PredicateColumnType final : public COWHelper; - bool is_numeric() const override { return false; } - size_t size() const override { return data.size(); } StringRef get_data_at(size_t n) const override { diff --git a/be/src/vec/data_types/data_type.h b/be/src/vec/data_types/data_type.h index 86f7cf36fa8dc7..6c54241ea18a2a 100644 --- a/be/src/vec/data_types/data_type.h +++ b/be/src/vec/data_types/data_type.h @@ -289,6 +289,7 @@ struct WhichDataType { bool is_aggregate_function() const { return idx == TypeIndex::AggregateFunction; } bool is_variant_type() const { return idx == TypeIndex::VARIANT; } bool is_simple() const { return is_int() || is_uint() || is_float() || is_string(); } + bool is_num_can_compare() const { return is_int_or_uint() || is_float() || is_ip(); } }; /// IDataType helpers (alternative for IDataType virtual methods with single point of truth) diff --git a/be/src/vec/functions/functions_comparison.h b/be/src/vec/functions/functions_comparison.h index 78a89071c76efd..cb56f176c71eb1 100644 --- a/be/src/vec/functions/functions_comparison.h +++ b/be/src/vec/functions/functions_comparison.h @@ -637,8 +637,8 @@ class FunctionComparison : public IFunction { WhichDataType which_left {left_type}; WhichDataType which_right {right_type}; - const bool left_is_num = col_left_untyped->is_numeric(); - const bool right_is_num = col_right_untyped->is_numeric(); + const bool left_is_num_can_compare = which_left.is_num_can_compare(); + const bool right_is_num_can_compare = which_right.is_num_can_compare(); const bool left_is_string = which_left.is_string_or_fixed_string(); const bool right_is_string = which_right.is_string_or_fixed_string(); @@ -648,7 +648,7 @@ class FunctionComparison : public IFunction { // bool date_and_datetime = (left_type != right_type) && which_left.is_date_or_datetime() && // which_right.is_date_or_datetime(); - if (left_is_num && right_is_num) { + if (left_is_num_can_compare && right_is_num_can_compare) { if (!(execute_num_left_type(block, result, col_left_untyped, col_right_untyped) || execute_num_left_type(block, result, col_left_untyped, diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java index a16422ba9e5979..c21c9ee3f86db9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java @@ -342,6 +342,11 @@ public String removeLastDBOfCatalog(String catalog) { return lastDBOfCatalog.get(catalog); } + // Used by COM_RESET_CONNECTION + public void clearLastDBOfCatalog() { + lastDBOfCatalog.clear(); + } + public void setNotEvalNondeterministicFunction(boolean notEvalNondeterministicFunction) { this.notEvalNondeterministicFunction = notEvalNondeterministicFunction; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index 2340aa37aebb55..fcc6c2362cf276 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -44,6 +44,7 @@ import org.apache.doris.common.util.SqlUtils; import org.apache.doris.common.util.Util; import org.apache.doris.datasource.CatalogIf; +import org.apache.doris.datasource.InternalCatalog; import org.apache.doris.metric.MetricRepo; import org.apache.doris.mysql.MysqlChannel; import org.apache.doris.mysql.MysqlPacket; @@ -198,6 +199,12 @@ protected void handleDebug() { ctx.getState().setOk(); } + protected void handleResetConnection() { + ctx.changeDefaultCatalog(InternalCatalog.INTERNAL_CATALOG_NAME); + ctx.clearLastDBOfCatalog(); + ctx.getState().setOk(); + } + protected void handleStmtReset() { ctx.getState().setOk(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java index 376d4740e632a1..da3baced5fad78 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java @@ -264,6 +264,9 @@ private void dispatch() throws IOException { case COM_SET_OPTION: handleSetOption(); break; + case COM_RESET_CONNECTION: + handleResetConnection(); + break; default: ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")"); LOG.warn("Unsupported command(" + command + ")");