You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/01/16 09:30:20 UTC

(doris) branch branch-2.0 updated: [branch-2.0](test-framework) Support operator performance test for branch2.0 (#29661)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 759a6943ec5 [branch-2.0](test-framework) Support operator performance test for branch2.0 (#29661)
759a6943ec5 is described below

commit 759a6943ec555aceafab742f461880e2d75773d2
Author: zclllyybb <zh...@selectdb.com>
AuthorDate: Tue Jan 16 17:30:12 2024 +0800

    [branch-2.0](test-framework) Support operator performance test for branch2.0 (#29661)
    
    * [Opt](functions) Opt tvf number for performance regression framework (#27582)
    
    Opt tvf number for performance regression framework
    
    * [Feature](functions) support ignore and nullable functions (#27848)
    
    support ignore and nullable functions
    
    * [Feature](function) support generating const values from tvf numbers (#28051)
    
    If specified, got a column of constant. otherwise an incremental series like it always be.
    
    mysql> select * from numbers("number" = "5", "const_value" = "-123");
    +--------+
    | number |
    +--------+
    |   -123 |
    |   -123 |
    |   -123 |
    |   -123 |
    |   -123 |
    +--------+
    5 rows in set (0.11 sec)
    
    * fix compile
    
    * [feature](nereids) support non_nullable function (#23762)
    
    * fix cases
    
    ---------
    
    Co-authored-by: minghong <en...@gmail.com>
---
 be/src/vec/columns/column_vector.h                 | 20 ++++-
 be/src/vec/columns/columns_number.h                |  2 +
 .../vec/exec/data_gen_functions/vnumbers_tvf.cpp   | 76 ++++++++++--------
 be/src/vec/exec/data_gen_functions/vnumbers_tvf.h  | 11 +--
 be/src/vec/functions/function_ignore.cpp           | 50 ++++++++++++
 ...tion_nonnullable.cpp => function_nullables.cpp} | 66 +++++++++++-----
 be/src/vec/functions/simple_function_factory.h     |  6 +-
 .../sql-functions/table-functions/numbers.md       | 31 +++++---
 .../sql-functions/table-functions/numbers.md       | 30 ++++---
 .../doris/catalog/BuiltinScalarFunctions.java      |  6 ++
 .../trees/expressions/functions/scalar/Ignore.java | 69 ++++++++++++++++
 .../expressions/functions/scalar/NonNullable.java  | 42 ++++++++++
 .../expressions/functions/scalar/Nullable.java     | 42 ++++++++++
 .../trees/expressions/functions/table/Numbers.java | 24 +++---
 .../expressions/visitor/ScalarFunctionVisitor.java |  5 ++
 .../tablefunction/NumbersTableValuedFunction.java  | 53 ++++++++-----
 gensrc/script/doris_builtins_functions.py          | 82 +++++++++++++++++++
 gensrc/thrift/PlanNodes.thrift                     |  4 +-
 .../data/external_table_p0/tvf/test_numbers.out    | 19 +++++
 .../cast_function/test_non_nullable_function.out   | 22 ------
 .../cast_function/test_nullable_functions.out      | 19 +++++
 .../external_table_p0/tvf/test_numbers.groovy      |  9 ++-
 .../test_non_nullable_function.groovy              | 50 ------------
 .../cast_function/test_nullable_functions.groovy   | 91 ++++++++++++++++++++++
 24 files changed, 643 insertions(+), 186 deletions(-)

diff --git a/be/src/vec/columns/column_vector.h b/be/src/vec/columns/column_vector.h
index 41000ffd281..512fe5e9ce7 100644
--- a/be/src/vec/columns/column_vector.h
+++ b/be/src/vec/columns/column_vector.h
@@ -145,7 +145,7 @@ public:
     using Container = PaddedPODArray<value_type>;
 
 private:
-    ColumnVector() {}
+    ColumnVector() = default;
     ColumnVector(const size_t n) : data(n) {}
     ColumnVector(const size_t n, const value_type x) : data(n, x) {}
     ColumnVector(const ColumnVector& src) : data(src.data.begin(), src.data.end()) {}
@@ -178,7 +178,7 @@ public:
     size_t size() const override { return data.size(); }
 
     StringRef get_data_at(size_t n) const override {
-        return StringRef(reinterpret_cast<const char*>(&data[n]), sizeof(data[n]));
+        return {reinterpret_cast<const char*>(&data[n]), sizeof(data[n])};
     }
 
     void insert_from(const IColumn& src, size_t n) override {
@@ -196,6 +196,22 @@ public:
         memcpy(data.data() + old_size, data_ptr, num * sizeof(T));
     }
 
+    void insert_raw_integers(T val, size_t n) {
+        auto old_size = data.size();
+        data.resize(old_size + n);
+        std::fill(data.data() + old_size, data.data() + old_size + n, val);
+    }
+
+    void insert_range_of_integer(T begin, T end)
+        requires std::is_fundamental_v<T>
+    {
+        auto old_size = data.size();
+        data.resize(old_size + (end - begin));
+        for (int i = 0; i < end - begin; i++) {
+            data[old_size + i] = begin + i;
+        }
+    }
+
     void insert_date_column(const char* data_ptr, size_t num) {
         data.reserve(data.size() + num);
         size_t input_value_size = sizeof(uint24_t);
diff --git a/be/src/vec/columns/columns_number.h b/be/src/vec/columns/columns_number.h
index 1ce930e4cd1..66c181af90c 100644
--- a/be/src/vec/columns/columns_number.h
+++ b/be/src/vec/columns/columns_number.h
@@ -40,6 +40,8 @@ using ColumnInt32 = ColumnVector<Int32>;
 using ColumnInt64 = ColumnVector<Int64>;
 using ColumnInt128 = ColumnVector<Int128>;
 
+using ColumnBool = ColumnUInt8;
+
 using ColumnDate = ColumnVector<Int64>;
 using ColumnDateTime = ColumnVector<Int64>;
 
diff --git a/be/src/vec/exec/data_gen_functions/vnumbers_tvf.cpp b/be/src/vec/exec/data_gen_functions/vnumbers_tvf.cpp
index 2ac6c0fca42..480a22d6942 100644
--- a/be/src/vec/exec/data_gen_functions/vnumbers_tvf.cpp
+++ b/be/src/vec/exec/data_gen_functions/vnumbers_tvf.cpp
@@ -21,61 +21,71 @@
 #include <gen_cpp/PlanNodes_types.h>
 #include <glog/logging.h>
 
+#include <algorithm>
 #include <utility>
 
 #include "common/status.h"
 #include "runtime/descriptors.h"
 #include "runtime/runtime_state.h"
 #include "vec/columns/column.h"
+#include "vec/columns/columns_number.h"
+#include "vec/common/assert_cast.h"
 #include "vec/core/block.h"
 #include "vec/core/column_with_type_and_name.h"
+#include "vec/core/types.h"
 #include "vec/data_types/data_type.h"
 
 namespace doris::vectorized {
 
+const static std::string NUMBER = std::string {"number"};
+const static std::string ZERO = std::string {"zero"};
+
 VNumbersTVF::VNumbersTVF(TupleId tuple_id, const TupleDescriptor* tuple_desc)
         : VDataGenFunctionInf(tuple_id, tuple_desc) {}
 
 Status VNumbersTVF::get_next(RuntimeState* state, vectorized::Block* block, bool* eos) {
-    bool mem_reuse = block->mem_reuse();
     DCHECK(block->rows() == 0);
+    RETURN_IF_CANCELLED(state);
+    bool mem_reuse = block->mem_reuse();
+    int batch_size = state->batch_size();
     std::vector<vectorized::MutableColumnPtr> columns(_slot_num);
 
-    do {
-        for (int i = 0; i < _slot_num; ++i) {
-            if (mem_reuse) {
-                columns[i] = std::move(*(block->get_by_position(i).column)).mutate();
-            } else {
-                columns[i] = _tuple_desc->slots()[i]->get_empty_mutable_column();
-            }
+    // now only support one column for tvf numbers
+    for (int i = 0; i < _slot_num; ++i) {
+        if (mem_reuse) {
+            columns[i] = std::move(*(block->get_by_position(i).column)).mutate();
+        } else {
+            columns[i] = _tuple_desc->slots()[i]->get_empty_mutable_column();
         }
-        while (true) {
-            RETURN_IF_CANCELLED(state);
-            int batch_size = state->batch_size();
-            if (columns[0]->size() == batch_size) {
-                // what if batch_size < _total_numbers, should we set *eos?
-                break;
-            }
-            // if _total_numbers == 0, so we can break loop at now.
-            if (_cur_offset >= _total_numbers) {
-                *eos = true;
-                break;
-            }
-            columns[0]->insert_data(reinterpret_cast<const char*>(&_cur_offset),
-                                    sizeof(_cur_offset));
-            ++_cur_offset;
+
+        if (_total_numbers <= 0) [[unlikely]] {
+            *eos = true;
+            continue;
         }
-        auto n_columns = 0;
-        if (!mem_reuse) {
-            for (const auto slot_desc : _tuple_desc->slots()) {
-                block->insert(ColumnWithTypeAndName(std::move(columns[n_columns++]),
-                                                    slot_desc->get_data_type_ptr(),
-                                                    slot_desc->col_name()));
-            }
+        auto* column_res = assert_cast<ColumnInt64*>(columns[i].get()); //BIGINT
+        int64_t end_value = std::min((int64_t)(_next_number + batch_size), _total_numbers);
+        if (_use_const) {
+            column_res->insert_raw_integers(_const_value, end_value - _next_number);
         } else {
-            columns.clear();
+            column_res->insert_range_of_integer(_next_number, end_value);
+        }
+        if (end_value == _total_numbers) {
+            *eos = true;
+        } else {
+            _next_number = end_value;
+        }
+    }
+
+    if (mem_reuse) {
+        columns.clear();
+    } else {
+        size_t n_columns = 0;
+        for (const auto* slot_desc : _tuple_desc->slots()) {
+            block->insert(ColumnWithTypeAndName(std::move(columns[n_columns++]),
+                                                slot_desc->get_data_type_ptr(),
+                                                slot_desc->col_name()));
         }
-    } while (block->rows() == 0 && !(*eos));
+    }
     return Status::OK();
 }
 
@@ -83,6 +93,8 @@ Status VNumbersTVF::set_scan_ranges(const std::vector<TScanRangeParams>& scan_ra
     // Currently we do not support multi-threads numbers function, so there is no need to
     // use more than one scan_range_param.
     DCHECK(scan_range_params.size() == 1);
+    _use_const = scan_range_params[0].scan_range.data_gen_scan_range.numbers_params.useConst;
+    _const_value = scan_range_params[0].scan_range.data_gen_scan_range.numbers_params.constValue;
     _total_numbers =
             scan_range_params[0].scan_range.data_gen_scan_range.numbers_params.totalNumbers;
     return Status::OK();
diff --git a/be/src/vec/exec/data_gen_functions/vnumbers_tvf.h b/be/src/vec/exec/data_gen_functions/vnumbers_tvf.h
index f65a777051b..1968637fd36 100644
--- a/be/src/vec/exec/data_gen_functions/vnumbers_tvf.h
+++ b/be/src/vec/exec/data_gen_functions/vnumbers_tvf.h
@@ -17,8 +17,7 @@
 
 #pragma once
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <vector>
 
 #include "common/global_types.h"
@@ -43,11 +42,13 @@ public:
 
     Status set_scan_ranges(const std::vector<TScanRangeParams>& scan_ranges) override;
 
-protected:
-    int64_t _total_numbers;
+private:
+    bool _use_const = false;
+    int64_t _const_value = 0;
+    int64_t _total_numbers = 0;
     // Number of returned columns, actually only 1 column
     int _slot_num = 1;
-    int64_t _cur_offset = 0;
+    int64_t _next_number = 0;
 };
 
 } // namespace vectorized
diff --git a/be/src/vec/functions/function_ignore.cpp b/be/src/vec/functions/function_ignore.cpp
new file mode 100644
index 00000000000..62e23f7e3b2
--- /dev/null
+++ b/be/src/vec/functions/function_ignore.cpp
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/columns/columns_number.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+class FunctionIgnore : public IFunction {
+public:
+    static constexpr auto name = "ignore";
+    String get_name() const override { return name; }
+
+    static FunctionPtr create() { return std::make_shared<FunctionIgnore>(); }
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+        return std::make_shared<DataTypeUInt8>();
+    }
+
+    bool is_variadic() const override { return true; }
+    size_t get_number_of_arguments() const override { return 0; }
+    bool use_default_implementation_for_nulls() const override { return false; }
+
+    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+                        size_t result, size_t input_rows_count) override {
+        ColumnPtr col = ColumnBool::create(1, false);
+        block.replace_by_position(result, ColumnConst::create(col, input_rows_count));
+        return Status::OK();
+    }
+};
+
+void register_function_ignore(SimpleFunctionFactory& factory) {
+    factory.register_function<FunctionIgnore>();
+}
+} // namespace doris::vectorized
diff --git a/be/src/vec/functions/function_nonnullable.cpp b/be/src/vec/functions/function_nullables.cpp
similarity index 52%
rename from be/src/vec/functions/function_nonnullable.cpp
rename to be/src/vec/functions/function_nullables.cpp
index 22d9c688b4f..766eeb13e49 100644
--- a/be/src/vec/functions/function_nonnullable.cpp
+++ b/be/src/vec/functions/function_nullables.cpp
@@ -14,18 +14,11 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-// This file is copied from
-// https://github.com/ClickHouse/ClickHouse/blob/master/src/Functions/Ifnull.h
-// and modified by Doris
-
-#include <stddef.h>
-
-#include <memory>
 
 #include "common/status.h"
-#include "vec/aggregate_functions/aggregate_function.h"
 #include "vec/columns/column.h"
 #include "vec/columns/column_nullable.h"
+#include "vec/columns/columns_number.h"
 #include "vec/core/block.h"
 #include "vec/core/column_numbers.h"
 #include "vec/core/column_with_type_and_name.h"
@@ -40,6 +33,38 @@ class FunctionContext;
 } // namespace doris
 
 namespace doris::vectorized {
+
+class FunctionNullable : public IFunction {
+public:
+    static constexpr auto name = "nullable";
+
+    static FunctionPtr create() { return std::make_shared<FunctionNullable>(); }
+
+    String get_name() const override { return name; }
+
+    size_t get_number_of_arguments() const override { return 1; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+        return make_nullable(arguments[0]);
+    }
+
+    bool use_default_implementation_for_nulls() const override { return false; }
+
+    // trans nullable column to non-nullable column. If argument is already non-nullable, raise error.
+    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+                        size_t result, size_t input_rows_count) override {
+        ColumnPtr& col = block.get_by_position(arguments[0]).column;
+        if (const auto* col_null = check_and_get_column<ColumnNullable>(col); col_null == nullptr) {
+            // not null
+            block.replace_by_position(
+                    result, ColumnNullable::create(col, ColumnBool::create(input_rows_count, 0)));
+        } else { // column is ColumnNullable
+            block.replace_by_position(result, col->clone_resized(input_rows_count));
+        }
+        return Status::OK();
+    }
+};
+
 class FunctionNonNullable : public IFunction {
 public:
     static constexpr auto name = "non_nullable";
@@ -60,23 +85,28 @@ public:
     Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
                         size_t result, size_t input_rows_count) override {
         auto& data = block.get_by_position(arguments[0]);
-        const ColumnNullable* column = check_and_get_column<ColumnNullable>(data.column);
-
-        if (column == nullptr) // raise error if input is not nullable.
+        if (const auto* col_null = check_and_get_column<ColumnNullable>(data.column);
+            col_null == nullptr) // raise error if input is not nullable.
         {
-            return Status::RuntimeError(
-                    "Try to use originally non-nullable column {} in nullable's non-nullable \
-                    convertion.",
-                    data.column->get_name(), get_name());
+            return Status::InvalidArgument(
+                    "Try to use originally non-nullable column {} in nullable's non-nullable "
+                    "convertion.",
+                    data.column->get_name());
         } else { // column is ColumnNullable
-            const ColumnPtr& type_ptr = column->get_nested_column_ptr();
-            block.replace_by_position(result, type_ptr->clone_resized(type_ptr->size()));
+            if (col_null->has_null()) [[unlikely]] {
+                return Status::InvalidArgument(
+                        "There's NULL value in column {} which is illegal for non_nullable",
+                        data.column->get_name());
+            }
+            const ColumnPtr& nest_col = col_null->get_nested_column_ptr();
+            block.replace_by_position(result, nest_col->clone_resized(nest_col->size()));
         }
         return Status::OK();
     }
 };
 
-void register_function_non_nullable(SimpleFunctionFactory& factory) {
+void register_function_nullables(SimpleFunctionFactory& factory) {
+    factory.register_function<FunctionNullable>();
     factory.register_function<FunctionNonNullable>();
 }
 
diff --git a/be/src/vec/functions/simple_function_factory.h b/be/src/vec/functions/simple_function_factory.h
index 264b398729a..ff4caa62422 100644
--- a/be/src/vec/functions/simple_function_factory.h
+++ b/be/src/vec/functions/simple_function_factory.h
@@ -55,7 +55,7 @@ void register_function_bitmap_variadic(SimpleFunctionFactory& factory);
 void register_function_quantile_state(SimpleFunctionFactory& factory);
 void register_function_is_null(SimpleFunctionFactory& factory);
 void register_function_is_not_null(SimpleFunctionFactory& factory);
-void register_function_non_nullable(SimpleFunctionFactory& factory);
+void register_function_nullables(SimpleFunctionFactory& factory);
 void register_function_to_time_function(SimpleFunctionFactory& factory);
 void register_function_time_of_function(SimpleFunctionFactory& factory);
 void register_function_string(SimpleFunctionFactory& factory);
@@ -92,6 +92,7 @@ void register_function_geo(SimpleFunctionFactory& factory);
 void register_function_multi_string_position(SimpleFunctionFactory& factory);
 void register_function_multi_string_search(SimpleFunctionFactory& factory);
 void register_function_width_bucket(SimpleFunctionFactory& factory);
+void register_function_ignore(SimpleFunctionFactory& factory);
 
 void register_function_encryption(SimpleFunctionFactory& factory);
 void register_function_regexp_extract(SimpleFunctionFactory& factory);
@@ -230,7 +231,7 @@ public:
             register_function_bit(instance);
             register_function_is_null(instance);
             register_function_is_not_null(instance);
-            register_function_non_nullable(instance);
+            register_function_nullables(instance);
             register_function_to_time_function(instance);
             register_function_time_of_function(instance);
             register_function_string(instance);
@@ -275,6 +276,7 @@ public:
             register_function_match(instance);
             register_function_tokenize(instance);
             register_function_ip(instance);
+            register_function_ignore(instance);
         });
         return instance;
     }
diff --git a/docs/en/docs/sql-manual/sql-functions/table-functions/numbers.md b/docs/en/docs/sql-manual/sql-functions/table-functions/numbers.md
index 916585255c0..723d62154aa 100644
--- a/docs/en/docs/sql-manual/sql-functions/table-functions/numbers.md
+++ b/docs/en/docs/sql-manual/sql-functions/table-functions/numbers.md
@@ -28,24 +28,23 @@ under the License.
 
 ### description
 
-Table-Value-Function, generate a temporary table with only one column named 'number', row values are [0,n).
-
-This function is used in FROM clauses.
+Table function that generates a temporary table containing only one column with the column name `number` and all element values are `const_value` if `const_value` is specified, otherwise they are [0,`number`) incremented.
 
 #### syntax
-
 ```sql
 numbers(
   "number" = "n"
+  <, "const_value" = "x">
   );
 ```
 
 parameter:
-- `number`: It means to generate rows [0, n).
+- `number`: Line number.
+- `const_value`: the constant value.
 
 ### example
 ```
-mysql> select * from numbers("number" = "10");
+mysql> select * from numbers("number" = "5");
 +--------+
 | number |
 +--------+
@@ -54,14 +53,22 @@ mysql> select * from numbers("number" = "10");
 |      2 |
 |      3 |
 |      4 |
-|      5 |
-|      6 |
-|      7 |
-|      8 |
-|      9 |
 +--------+
+5 rows in set (0.11 sec)
+
+mysql> select * from numbers("number" = "5", "const_value" = "-123");
++--------+
+| number |
++--------+
+|   -123 |
+|   -123 |
+|   -123 |
+|   -123 |
+|   -123 |
++--------+
+5 rows in set (0.12 sec)
 ```
 
 ### keywords
 
-    numbers
\ No newline at end of file
+    numbers, const_value
\ No newline at end of file
diff --git a/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/numbers.md b/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/numbers.md
index 1223236b117..2215a5f1df6 100644
--- a/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/numbers.md
+++ b/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/numbers.md
@@ -28,23 +28,23 @@ under the License.
 
 ### description
 
-表函数,生成一张只含有一列的临时表,列名为`number`,行的值为[0,n)。
-
-该函数用于from子句中。
+表函数,生成一张只含有一列的临时表,列名为`number`,如果指定了`const_value`,则所有元素值均为`const_value`,否则为[0,`number`)递增。
 
 #### syntax
 ```sql
 numbers(
   "number" = "n"
+  <, "const_value" = "x">
   );
 ```
 
 参数:
-- `number`: 代表生成[0,n)的行。
+- `number`: 行数。
+- `const_value` : 常量值。
 
 ### example
 ```
-mysql> select * from numbers("number" = "10");
+mysql> select * from numbers("number" = "5");
 +--------+
 | number |
 +--------+
@@ -53,16 +53,24 @@ mysql> select * from numbers("number" = "10");
 |      2 |
 |      3 |
 |      4 |
-|      5 |
-|      6 |
-|      7 |
-|      8 |
-|      9 |
 +--------+
+5 rows in set (0.11 sec)
+
+mysql> select * from numbers("number" = "5", "const_value" = "-123");
++--------+
+| number |
++--------+
+|   -123 |
+|   -123 |
+|   -123 |
+|   -123 |
+|   -123 |
++--------+
+5 rows in set (0.12 sec)
 ```
 
 ### keywords
 
-    numbers
+    numbers, const_value
 
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
index 5b7e6102bfc..174b35df437 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
@@ -143,6 +143,7 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursAdd;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursDiff;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursSub;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.If;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Ignore;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Initcap;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Instr;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.JsonArray;
@@ -221,10 +222,12 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.MultiSearchAl
 import org.apache.doris.nereids.trees.expressions.functions.scalar.MurmurHash332;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.MurmurHash364;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Negative;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.NonNullable;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.NotNullOrEmpty;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Now;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.NullIf;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.NullOrEmpty;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Nullable;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Nvl;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.ParseUrl;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Pi;
@@ -479,6 +482,7 @@ public class BuiltinScalarFunctions implements FunctionHelper {
             scalar(HoursDiff.class, "hours_diff"),
             scalar(HoursSub.class, "hours_sub"),
             scalar(If.class, "if"),
+            scalar(Ignore.class, "ignore"),
             scalar(Initcap.class, "initcap"),
             scalar(Instr.class, "instr"),
             scalar(JsonArray.class, "json_array"),
@@ -557,8 +561,10 @@ public class BuiltinScalarFunctions implements FunctionHelper {
             scalar(MurmurHash332.class, "murmur_hash3_32"),
             scalar(MurmurHash364.class, "murmur_hash3_64"),
             scalar(Negative.class, "negative"),
+            scalar(NonNullable.class, "non_nullable"),
             scalar(NotNullOrEmpty.class, "not_null_or_empty"),
             scalar(Now.class, "now", "current_timestamp", "localtime", "localtimestamp"),
+            scalar(Nullable.class, "nullable"),
             scalar(NullIf.class, "nullif"),
             scalar(NullOrEmpty.class, "null_or_empty"),
             scalar(Nvl.class, "ifnull", "nvl"),
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ignore.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ignore.java
new file mode 100644
index 00000000000..029e9fea3e3
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ignore.java
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions.scalar;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
+import org.apache.doris.nereids.trees.expressions.functions.CustomSignature;
+import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.BooleanType;
+import org.apache.doris.nereids.util.ExpressionUtils;
+
+import com.google.common.base.Preconditions;
+
+import java.util.List;
+
+/**
+ * accept any arguments, return false.
+ */
+public class Ignore extends ScalarFunction implements CustomSignature, AlwaysNotNullable {
+    /**
+     * constructor with 0 argument.
+     */
+    public Ignore() {
+        super("ignore");
+    }
+
+    /**
+     * constructor with 1 or more arguments.
+     */
+    public Ignore(Expression arg, Expression... varArgs) {
+        super("ignore", ExpressionUtils.mergeArguments(arg, varArgs));
+    }
+
+    @Override
+    public FunctionSignature customSignature() {
+        return FunctionSignature.of(BooleanType.INSTANCE, true, getArgumentsTypes());
+    }
+
+    /**
+     * withChildren.
+     */
+    @Override
+    public Ignore withChildren(List<Expression> children) {
+        Preconditions.checkArgument(children.size() >= 1);
+        return new Ignore(children.get(0),
+                children.subList(1, children.size()).toArray(new Expression[0]));
+    }
+
+    @Override
+    public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
+        return visitor.visitIgnore(this, context);
+    }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NonNullable.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NonNullable.java
new file mode 100644
index 00000000000..b9cec8e3ced
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NonNullable.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions.scalar;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
+import org.apache.doris.nereids.trees.expressions.functions.CustomSignature;
+import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import org.apache.doris.nereids.types.DataType;
+
+/**
+ * change nullable input col to non_nullable col
+ */
+public class NonNullable extends ScalarFunction implements UnaryExpression, CustomSignature, AlwaysNotNullable {
+
+    public NonNullable(Expression expr) {
+        super("non_nullable", expr);
+    }
+
+    @Override
+    public FunctionSignature customSignature() {
+        DataType dataType = getArgument(0).getDataType();
+        return FunctionSignature.ret(dataType).args(dataType);
+    }
+
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nullable.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nullable.java
new file mode 100644
index 00000000000..49db085a5f9
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nullable.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions.scalar;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
+import org.apache.doris.nereids.trees.expressions.functions.CustomSignature;
+import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import org.apache.doris.nereids.types.DataType;
+
+/**
+ * change non_nullable input col to nullable col
+ */
+public class Nullable extends ScalarFunction implements UnaryExpression, CustomSignature, AlwaysNullable {
+
+    public Nullable(Expression expr) {
+        super("nullable", expr);
+    }
+
+    @Override
+    public FunctionSignature customSignature() {
+        DataType dataType = getArgument(0).getDataType();
+        return FunctionSignature.ret(dataType).args(dataType);
+    }
+
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Numbers.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Numbers.java
index 9b24fcfd623..07be02423a2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Numbers.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Numbers.java
@@ -65,17 +65,23 @@ public class Numbers extends TableValuedFunction {
     public Statistics computeStats(List<Slot> slots) {
         Preconditions.checkArgument(slots.size() == 1);
         try {
-            NumbersTableValuedFunction catalogFunction = (NumbersTableValuedFunction) getCatalogFunction();
-            long rowNum = catalogFunction.getTotalNumbers();
+            NumbersTableValuedFunction numberTvf = (NumbersTableValuedFunction) getCatalogFunction();
+            long rowNum = numberTvf.getTotalNumbers();
 
             Map<Expression, ColumnStatistic> columnToStatistics = Maps.newHashMap();
-            ColumnStatistic columnStat = new ColumnStatisticBuilder()
-                    .setCount(rowNum).setNdv(rowNum).setAvgSizeByte(8).setNumNulls(0).setDataSize(8).setMinValue(0)
-                    .setMaxValue(rowNum - 1)
-                    .setMinExpr(new IntLiteral(0, Type.BIGINT))
-                    .setMaxExpr(new IntLiteral(rowNum - 1, Type.BIGINT))
-                    .build();
-            columnToStatistics.put(slots.get(0), columnStat);
+            ColumnStatisticBuilder statBuilder = new ColumnStatisticBuilder()
+                    .setCount(rowNum).setAvgSizeByte(8).setNumNulls(0).setDataSize(8);
+            if (numberTvf.getUseConst()) { // a column of const value
+                long value = numberTvf.getConstValue();
+                statBuilder = statBuilder.setNdv(1).setMinValue(value).setMaxValue(value)
+                        .setMinExpr(new IntLiteral(value, Type.BIGINT))
+                        .setMaxExpr(new IntLiteral(value, Type.BIGINT));
+            } else { // a column of increasing value
+                statBuilder = statBuilder.setNdv(rowNum).setMinValue(0).setMaxValue(rowNum - 1)
+                        .setMinExpr(new IntLiteral(0, Type.BIGINT))
+                        .setMaxExpr(new IntLiteral(rowNum - 1, Type.BIGINT));
+            }
+            columnToStatistics.put(slots.get(0), statBuilder.build());
             return new Statistics(rowNum, columnToStatistics);
         } catch (Exception t) {
             throw new NereidsException(t.getMessage(), t);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
index dd783e45438..8b8b6ce21f4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
@@ -140,6 +140,7 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursAdd;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursDiff;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursSub;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.If;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Ignore;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Initcap;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Instr;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.JsonArray;
@@ -875,6 +876,10 @@ public interface ScalarFunctionVisitor<R, C> {
         return visitScalarFunction(function, context);
     }
 
+    default R visitIgnore(Ignore function, C context) {
+        return visitScalarFunction(function, context);
+    }
+
     default R visitInitcap(Initcap initcap, C context) {
         return visitScalarFunction(initcap, context);
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/NumbersTableValuedFunction.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/NumbersTableValuedFunction.java
index 3c0b578b50a..8d4a627043e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/NumbersTableValuedFunction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/NumbersTableValuedFunction.java
@@ -27,10 +27,8 @@ import org.apache.doris.thrift.TDataGenScanRange;
 import org.apache.doris.thrift.TScanRange;
 import org.apache.doris.thrift.TTVFNumbersScanRange;
 
-import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -46,11 +44,15 @@ import java.util.Map;
 public class NumbersTableValuedFunction extends DataGenTableValuedFunction {
     public static final String NAME = "numbers";
     public static final String NUMBER = "number";
+    public static final String CONST_VALUE = "const_value";
     private static final ImmutableSet<String> PROPERTIES_SET = new ImmutableSet.Builder<String>()
             .add(NUMBER)
+            .add(CONST_VALUE)
             .build();
     // The total numbers will be generated.
     private long totalNumbers;
+    private boolean useConst = false;
+    private long constValue;
 
     /**
      * Constructor.
@@ -58,24 +60,27 @@ public class NumbersTableValuedFunction extends DataGenTableValuedFunction {
      * @throws AnalysisException exception
      */
     public NumbersTableValuedFunction(Map<String, String> params) throws AnalysisException {
-        Map<String, String> validParams = Maps.newHashMap();
-        for (String key : params.keySet()) {
-            if (!PROPERTIES_SET.contains(key.toLowerCase())) {
-                throw new AnalysisException(key + " is invalid property");
-            }
-            validParams.put(key.toLowerCase(), params.get(key));
+        if (!params.containsKey(NUMBER)) {
+            throw new AnalysisException("number not set");
         }
-
-        String numberStr = validParams.get(NUMBER);
-        if (!Strings.isNullOrEmpty(numberStr)) {
-            try {
-                totalNumbers = Long.parseLong(numberStr);
-            } catch (NumberFormatException e) {
-                throw new AnalysisException("can not parse `number` param to natural number");
+        for (String key : params.keySet()) {
+            if (PROPERTIES_SET.contains(key)) {
+                try {
+                    switch (key) {
+                        case NUMBER:
+                            totalNumbers = Long.parseLong(params.get(key));
+                            break;
+                        case CONST_VALUE:
+                            useConst = true;
+                            constValue = Long.parseLong(params.get(key));
+                            break;
+                        default:
+                            break;
+                    }
+                } catch (NumberFormatException e) {
+                    throw new AnalysisException("cannot parse param value " + params.get(key));
+                }
             }
-        } else {
-            throw new AnalysisException(
-                    "can not find `number` param, please specify `number`, like: numbers(\"number\" = \"10\")");
         }
     }
 
@@ -83,6 +88,14 @@ public class NumbersTableValuedFunction extends DataGenTableValuedFunction {
         return totalNumbers;
     }
 
+    public boolean getUseConst() {
+        return useConst;
+    }
+
+    public long getConstValue() {
+        return constValue;
+    }
+
     @Override
     public TDataGenFunctionName getDataGenFunctionName() {
         return TDataGenFunctionName.NUMBERS;
@@ -116,8 +129,8 @@ public class NumbersTableValuedFunction extends DataGenTableValuedFunction {
         List<TableValuedFunctionTask> res = Lists.newArrayList();
         TScanRange scanRange = new TScanRange();
         TDataGenScanRange dataGenScanRange = new TDataGenScanRange();
-        TTVFNumbersScanRange tvfNumbersScanRange = new TTVFNumbersScanRange();
-        tvfNumbersScanRange.setTotalNumbers(totalNumbers);
+        TTVFNumbersScanRange tvfNumbersScanRange = new TTVFNumbersScanRange().setTotalNumbers(totalNumbers)
+                .setUseConst(useConst).setConstValue(constValue);
         dataGenScanRange.setNumbersParams(tvfNumbersScanRange);
         scanRange.setDataGenScanRange(dataGenScanRange);
         res.add(new TableValuedFunctionTask(backendList.get(0), scanRange));
diff --git a/gensrc/script/doris_builtins_functions.py b/gensrc/script/doris_builtins_functions.py
index a6072ae764b..9b812852431 100644
--- a/gensrc/script/doris_builtins_functions.py
+++ b/gensrc/script/doris_builtins_functions.py
@@ -2013,6 +2013,88 @@ visible_functions = {
         [['non_nullable'], 'ARRAY_DECIMAL128', ['ARRAY_DECIMAL128'], 'ALWAYS_NOT_NULLABLE'],
         [['non_nullable'], 'ARRAY_VARCHAR', ['ARRAY_VARCHAR'], 'ALWAYS_NOT_NULLABLE'],
         [['non_nullable'], 'ARRAY_STRING', ['ARRAY_STRING'], 'ALWAYS_NOT_NULLABLE']
+    ],
+
+    "Nullalbe": [
+        [['nullable'], 'BOOLEAN', ['BOOLEAN'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'TINYINT', ['TINYINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'SMALLINT', ['SMALLINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'INT', ['INT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'BIGINT', ['BIGINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'LARGEINT', ['LARGEINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'FLOAT', ['FLOAT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DOUBLE', ['DOUBLE'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DATE', ['DATE'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DATEV2', ['DATEV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DATETIME', ['DATETIME'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DATETIMEV2', ['DATETIMEV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DECIMALV2', ['DECIMALV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DECIMAL32', ['DECIMAL32'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DECIMAL64', ['DECIMAL64'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'DECIMAL128', ['DECIMAL128'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'VARCHAR', ['VARCHAR'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'STRING', ['STRING'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'BITMAP', ['BITMAP'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'JSONB', ['JSONB'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_BOOLEAN', ['ARRAY_BOOLEAN'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_TINYINT', ['ARRAY_TINYINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_SMALLINT', ['ARRAY_SMALLINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_INT', ['ARRAY_INT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_BIGINT', ['ARRAY_BIGINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_LARGEINT', ['ARRAY_LARGEINT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DATETIME', ['ARRAY_DATETIME'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DATE', ['ARRAY_DATE'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DATETIMEV2', ['ARRAY_DATETIMEV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DATEV2', ['ARRAY_DATEV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_FLOAT', ['ARRAY_FLOAT'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DOUBLE', ['ARRAY_DOUBLE'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DECIMALV2', ['ARRAY_DECIMALV2'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DECIMAL32', ['ARRAY_DECIMAL32'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DECIMAL64', ['ARRAY_DECIMAL64'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_DECIMAL128', ['ARRAY_DECIMAL128'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_VARCHAR', ['ARRAY_VARCHAR'], 'ALWAYS_NULLABLE'],
+        [['nullable'], 'ARRAY_STRING', ['ARRAY_STRING'], 'ALWAYS_NULLABLE']
+    ],
+
+    "Ignore": [
+        [['ignore'], 'BOOLEAN', ['BOOLEAN', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['TINYINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['SMALLINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['INT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['BIGINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['LARGEINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['FLOAT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DOUBLE', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DATE', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DATEV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DATETIME', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DATETIMEV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DECIMALV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DECIMAL32', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DECIMAL64', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['DECIMAL128', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['VARCHAR', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['STRING', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['BITMAP', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['JSONB', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_BOOLEAN', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_TINYINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_SMALLINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_INT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_BIGINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_LARGEINT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DATETIME', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DATE', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DATETIMEV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DATEV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_FLOAT', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DOUBLE', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DECIMALV2', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DECIMAL32', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DECIMAL64', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_DECIMAL128', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_VARCHAR', '...'], 'ALWAYS_NOT_NULLABLE'],
+        [['ignore'], 'BOOLEAN', ['ARRAY_STRING', '...'], 'ALWAYS_NOT_NULLABLE']
     ]
 }
 
diff --git a/gensrc/thrift/PlanNodes.thrift b/gensrc/thrift/PlanNodes.thrift
index 506dd6e3f4f..ca608ca86ca 100644
--- a/gensrc/thrift/PlanNodes.thrift
+++ b/gensrc/thrift/PlanNodes.thrift
@@ -449,7 +449,9 @@ enum TDataGenFunctionName {
 // Every table valued function should have a scan range definition to save its
 // running parameters
 struct TTVFNumbersScanRange {
-	1: optional i64 totalNumbers
+  1: optional i64 totalNumbers
+  2: optional bool useConst
+  3: optional i64 constValue
 }
 
 struct TDataGenScanRange {
diff --git a/regression-test/data/external_table_p0/tvf/test_numbers.out b/regression-test/data/external_table_p0/tvf/test_numbers.out
index ef65f7eea52..72ae8c9e44f 100644
--- a/regression-test/data/external_table_p0/tvf/test_numbers.out
+++ b/regression-test/data/external_table_p0/tvf/test_numbers.out
@@ -123,6 +123,25 @@
 3
 4
 
+-- !const1 --
+1
+1
+1
+1
+1
+
+-- !const2 --
+-123
+-123
+-123
+-123
+-123
+
+-- !const3 --
+
+-- !const4 --
+123.0
+
 -- !agg_sum --
 4950
 
diff --git a/regression-test/data/query_p0/sql_functions/cast_function/test_non_nullable_function.out b/regression-test/data/query_p0/sql_functions/cast_function/test_non_nullable_function.out
deleted file mode 100644
index 8d3d92153a5..00000000000
--- a/regression-test/data/query_p0/sql_functions/cast_function/test_non_nullable_function.out
+++ /dev/null
@@ -1,22 +0,0 @@
--- This file is automatically generated. You should know what you did if you want to edit this
--- !nullable --
-\N	0
-1	1
-2	2
-3	3
-4	4
-
--- !nullable --
-\N	[]
-1	[1, 2, 3]
-2	[]
-3	[1, 2, 3]
-4	[]
-
--- !nullable --
-\N	[]
-1	["a", "b", "c"]
-2	[]
-3	[]
-4	["a", "b", "c"]
-
diff --git a/regression-test/data/query_p0/sql_functions/cast_function/test_nullable_functions.out b/regression-test/data/query_p0/sql_functions/cast_function/test_nullable_functions.out
new file mode 100644
index 00000000000..a1dbcd195a1
--- /dev/null
+++ b/regression-test/data/query_p0/sql_functions/cast_function/test_nullable_functions.out
@@ -0,0 +1,19 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !nullable_1 --
+1	1	1
+2	2	2
+3	3	3
+4	4	4
+
+-- !nullable_4 --
+1	1	1
+2	2	2
+3	3	3
+4	4	4
+
+-- !ignore --
+false
+false
+false
+false
+
diff --git a/regression-test/suites/external_table_p0/tvf/test_numbers.groovy b/regression-test/suites/external_table_p0/tvf/test_numbers.groovy
index 05c18f51b59..1dd2b6daaf9 100644
--- a/regression-test/suites/external_table_p0/tvf/test_numbers.groovy
+++ b/regression-test/suites/external_table_p0/tvf/test_numbers.groovy
@@ -23,6 +23,11 @@
     qt_basic3 """ select * from numbers("number" = "100"); """
     qt_basic4_limit """ select * from numbers("number" = "10") limit 5; """
 
+    qt_const1 """ select * from numbers("number" = "5", "const_value" = "1"); """
+    qt_const2 """ select * from numbers("number" = "5", "const_value" = "-123"); """
+    qt_const3 """ select * from numbers("number" = "-10", "const_value" = "1"); """
+    qt_const4 """ select avg(number) from numbers("number" = "100", "const_value" = "123"); """
+
     // Test aggregate function withh numbers("number" = N)
     qt_agg_sum """ select sum(number) from numbers("number" = "100"); """
     qt_agg_avg """ select avg(number) from numbers("number" = "100"); """
@@ -129,13 +134,13 @@
         sql """ select * from numbers('number' = 'abc'); """
 
         // check exception
-        exception "can not parse `number` param to natural number"
+        exception "cannot parse param value abc"
     }
 
     test {
         sql """ select * from numbers(); """
 
         // check exception
-        exception """can not find `number` param, please specify `number`, like: numbers("number" = "10")"""
+        exception """number not set"""
     }
  }
diff --git a/regression-test/suites/query_p0/sql_functions/cast_function/test_non_nullable_function.groovy b/regression-test/suites/query_p0/sql_functions/cast_function/test_non_nullable_function.groovy
deleted file mode 100644
index 02c384a8bb4..00000000000
--- a/regression-test/suites/query_p0/sql_functions/cast_function/test_non_nullable_function.groovy
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-suite("test_non_nullable_function", "query") {
-    def tableName = "tbl_test_non_nullable_function"
-
-    sql """DROP TABLE IF EXISTS ${tableName}"""
-    sql """
-            CREATE TABLE IF NOT EXISTS ${tableName} (
-              `k1` int(11) NULL COMMENT "",
-              `k2` ARRAY<int(11)> NULL COMMENT "",
-              `k3` ARRAY<VARCHAR(11)> NULL COMMENT "",
-              `k4` ARRAY<decimal(27,9)> NOT NULL COMMENT ""
-            ) ENGINE=OLAP
-            DUPLICATE KEY(`k1`)
-            DISTRIBUTED BY HASH(`k1`) BUCKETS 1
-            PROPERTIES (
-            "replication_allocation" = "tag.location.default: 1",
-            "storage_format" = "V2"
-            )
-        """
-    sql """ INSERT INTO ${tableName} VALUES(1, [1, 2, 3], ["a", "b", "c"], [1.3, 2.14]) """
-    sql """ INSERT INTO ${tableName} VALUES(2, [], [], [1.3, 2.14]) """
-    sql """ INSERT INTO ${tableName} VALUES(3, [1, 2, 3], [], [1.3, 2.14]) """
-    sql """ INSERT INTO ${tableName} VALUES(4, [], ["a", "b", "c"], [1.3, 2.14]) """
-    sql """ INSERT INTO ${tableName} VALUES(null, null, null, [1.1,2.2,3.3]) """
-    
-    qt_nullable "SELECT k1, non_nullable(k1) FROM ${tableName} ORDER BY k1"
-    qt_nullable "SELECT k1, non_nullable(k2) FROM ${tableName} ORDER BY k1"
-    qt_nullable "SELECT k1, non_nullable(k3) FROM ${tableName} ORDER BY k1"
-    try {
-        def result = "SELECT k1, non_nullable(k4) FROM ${tableName} ORDER BY k1"
-    } catch (Exception e) {
-        assertTrue(e.getMessage().contains("Try to use originally non-nullable column"))
-    }
-}
diff --git a/regression-test/suites/query_p0/sql_functions/cast_function/test_nullable_functions.groovy b/regression-test/suites/query_p0/sql_functions/cast_function/test_nullable_functions.groovy
new file mode 100644
index 00000000000..b4f914e252b
--- /dev/null
+++ b/regression-test/suites/query_p0/sql_functions/cast_function/test_nullable_functions.groovy
@@ -0,0 +1,91 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_nullable_functions", "query") {
+    def tableName = "test_nullable_functions"
+
+    sql """DROP TABLE IF EXISTS ${tableName}"""
+    // sql """
+    //         CREATE TABLE IF NOT EXISTS ${tableName} (
+    //           `k1` int(11) NULL COMMENT "",
+    //           `k2` ARRAY<int(11)> NULL COMMENT "",
+    //           `k3` ARRAY<VARCHAR(11)> NULL COMMENT "",
+    //           `k4` ARRAY<decimal(27,9)> NOT NULL COMMENT "",
+    //           `k5` int(11) NOT NULL,
+    //           `k6` int(11) NULL
+    //         ) ENGINE=OLAP
+    //         DUPLICATE KEY(`k1`)
+    //         DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+    //         PROPERTIES (
+    //             "replication_allocation" = "tag.location.default: 1",
+    //             "storage_format" = "V2"
+    //         )
+    //     """
+    sql """
+            CREATE TABLE IF NOT EXISTS ${tableName} (
+              `k1` int(11) NULL COMMENT "",
+              `k5` int(11) NOT NULL,
+              `k6` int(11) NULL
+            ) ENGINE=OLAP
+            DUPLICATE KEY(`k1`)
+            DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+            PROPERTIES (
+                "replication_allocation" = "tag.location.default: 1",
+                "storage_format" = "V2"
+            )
+        """
+    // sql """ INSERT INTO ${tableName} VALUES(1, [1, 2, 3], ["a", "b", "c"], [1.3, 2.14], 1, 1) """
+    // sql """ INSERT INTO ${tableName} VALUES(2, [], [], [1.3, 2.14], 2, 2) """
+    // sql """ INSERT INTO ${tableName} VALUES(3, [1, 2, 3], [], [1.3, 2.14], 3, 3) """
+    // sql """ INSERT INTO ${tableName} VALUES(4, [], ["a", "b", "c"], [1.3, 2.14], 4, null) """
+    sql """ INSERT INTO ${tableName} VALUES(1, 1, 1) """
+    sql """ INSERT INTO ${tableName} VALUES(2, 2, 2) """
+    sql """ INSERT INTO ${tableName} VALUES(3, 3, 3) """
+    sql """ INSERT INTO ${tableName} VALUES(4, 4, null) """
+
+    sql "set enable_nereids_planner=false"
+    qt_nullable_1 "SELECT k1, non_nullable(k1), nullable(k1) FROM ${tableName} ORDER BY k1"
+    // qt_nullable_2 "SELECT k1, non_nullable(k2), nullable(k4) FROM ${tableName} ORDER BY k1"
+    // qt_nullable_3 "SELECT k1, non_nullable(k3), nullable(k5) FROM ${tableName} ORDER BY k1"
+    // try {
+    //     def result = sql "SELECT k1, non_nullable(k4) FROM ${tableName} ORDER BY k1"
+    //     fail()
+    // } catch (Exception e) {
+    //     assertTrue(e.getMessage().contains("Try to use originally non-nullable column"))
+    // }
+    try {
+        result = sql "SELECT k1, non_nullable(k6) FROM ${tableName} ORDER BY k1"
+        fail()
+    } catch (Exception e) {
+        assertTrue(e.getMessage().contains("There's NULL value"))
+    }
+
+    sql "set enable_nereids_planner=true"
+    sql "set forbid_unknown_col_stats=false"
+    sql "set enable_fallback_to_original_planner=false"
+    qt_nullable_4 "SELECT k1, non_nullable(k1), nullable(k1) FROM ${tableName} ORDER BY k1"
+    // qt_nullable_5 "SELECT k1, non_nullable(k2), nullable(k4) FROM ${tableName} ORDER BY k1"
+    // qt_nullable_6 "SELECT k1, non_nullable(k3), nullable(k5) FROM ${tableName} ORDER BY k1"
+    // try {
+    //     result = sql "SELECT k1, non_nullable(k4) FROM ${tableName} ORDER BY k1"
+    //     fail()
+    // } catch (Exception e) {
+    //     assertTrue(e.getMessage().contains("Try to use originally non-nullable column"))
+    // }
+    // qt_ignore "SELECT ignore(k1*k5, k2, k3, k4, k5) FROM ${tableName} ORDER BY k1"
+    qt_ignore "SELECT ignore(k1*k5, k5) FROM ${tableName} ORDER BY k1"
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org