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 1b99746355 [Bug](function) enchance esquery error msg && forbid 
to_quantile_state #16274
1b99746355 is described below

commit 1b99746355ec22edd44c38f33e3473356e275044
Author: Pxl <[email protected]>
AuthorDate: Wed Feb 1 14:06:09 2023 +0800

    [Bug](function) enchance esquery error msg && forbid to_quantile_state 
#16274
    
    forbidden to_quantile_state temporary to avoid core dump. waiting for 
[Feature] support QuantileState in vectorized engine #15868 get the ball 
rolling on implementation.
---
 be/src/vec/functions/function_fake.cpp             | 25 +++++++++++++++-------
 be/src/vec/functions/function_fake.h               | 11 ++--------
 .../apache/doris/analysis/FunctionCallExpr.java    |  1 +
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/be/src/vec/functions/function_fake.cpp 
b/be/src/vec/functions/function_fake.cpp
index faf8d0d525..7e6cc25d04 100644
--- a/be/src/vec/functions/function_fake.cpp
+++ b/be/src/vec/functions/function_fake.cpp
@@ -17,11 +17,11 @@
 
 #include "vec/functions/function_fake.h"
 
-#include <boost/metaparse/string.hpp>
-#include <string_view>
-#include <type_traits>
-
+#include "vec/data_types/data_type_array.h"
 #include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/function_helpers.h"
+#include "vec/functions/simple_function_factory.h"
 
 namespace doris::vectorized {
 
@@ -33,6 +33,7 @@ struct FunctionFakeBaseImpl {
         }
         return std::make_shared<ReturnType>();
     }
+    static std::string get_error_msg() { return "Fake function do not support 
execute"; }
 };
 
 struct FunctionExplode {
@@ -41,11 +42,19 @@ struct FunctionExplode {
         return make_nullable(
                 
check_and_get_data_type<DataTypeArray>(arguments[0].get())->get_nested_type());
     }
+    static std::string get_error_msg() { return "Fake function do not support 
execute"; }
 };
 
-template <typename ReturnType, bool Nullable = false>
-void register_function_default(SimpleFunctionFactory& factory, const 
std::string& name) {
-    factory.register_function<FunctionFake<FunctionFakeBaseImpl<ReturnType, 
Nullable>>>(name);
+struct FunctionEsquery {
+    static DataTypePtr get_return_type_impl(const DataTypes& arguments) {
+        return 
FunctionFakeBaseImpl<DataTypeUInt8>::get_return_type_impl(arguments);
+    }
+    static std::string get_error_msg() { return "esquery only supported on es 
table"; }
+};
+
+template <typename FunctionImpl>
+void register_function(SimpleFunctionFactory& factory, const std::string& 
name) {
+    factory.register_function<FunctionFake<FunctionImpl>>(name);
 };
 
 template <typename FunctionImpl>
@@ -74,7 +83,7 @@ void 
register_table_function_expand_outer_default(SimpleFunctionFactory& factory
 };
 
 void register_function_fake(SimpleFunctionFactory& factory) {
-    register_function_default<DataTypeUInt8>(factory, "esquery");
+    register_function<FunctionEsquery>(factory, "esquery");
 
     register_table_function_expand_outer<FunctionExplode>(factory, "explode");
 
diff --git a/be/src/vec/functions/function_fake.h 
b/be/src/vec/functions/function_fake.h
index 475850671e..0f2c83aed0 100644
--- a/be/src/vec/functions/function_fake.h
+++ b/be/src/vec/functions/function_fake.h
@@ -18,14 +18,7 @@
 #pragma once
 
 #include "common/status.h"
-#include "vec/core/types.h"
-#include "vec/data_types/data_type_array.h"
-#include "vec/data_types/data_type_nullable.h"
-#include "vec/data_types/data_type_number.h"
-#include "vec/data_types/data_type_string.h"
-#include "vec/functions/function_helpers.h"
-#include "vec/functions/simple_function_factory.h"
-#include "vec/utils/util.hpp"
+#include "vec/functions/function.h"
 
 namespace doris::vectorized {
 // FunctionFake is use for some function call expr only work at prepare/open 
phase, do not support execute().
@@ -50,7 +43,7 @@ public:
 
     Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
                         size_t result, size_t input_rows_count) override {
-        return Status::NotSupported("Fake function {} do not support execute", 
name);
+        return Status::NotSupported(Impl::get_error_msg());
     }
 };
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 17eebe567a..6cc8e6da7c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -853,6 +853,7 @@ public class FunctionCallExpr extends Expr {
             if (!getChild(1).isConstant()) {
                 throw new AnalysisException(fnName + "function's second 
argument should be constant");
             }
+            throw new AnalysisException(fnName + "not support on vectorized 
engine now.");
         }
 
         if ((fnName.getFunction().equalsIgnoreCase("HLL_UNION_AGG")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to