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 2b2d3d0eb14 [fix](meta_scanner) fix meta_scanner process 
ColumnNullable (#28711)
2b2d3d0eb14 is described below

commit 2b2d3d0eb1410231dee690b4983cee05061c47c1
Author: zhiqiang <seuhezhiqi...@163.com>
AuthorDate: Wed Dec 20 17:41:38 2023 +0800

    [fix](meta_scanner) fix meta_scanner process ColumnNullable (#28711)
---
 be/src/vec/exec/scan/vmeta_scanner.cpp               | 20 +++++++++++++++-----
 .../sql-functions/table-functions/queries.md         |  6 +++---
 .../sql-functions/table-functions/queries.md         |  6 +++---
 .../tablefunction/QueriesTableValuedFunction.java    |  6 +++---
 4 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/be/src/vec/exec/scan/vmeta_scanner.cpp 
b/be/src/vec/exec/scan/vmeta_scanner.cpp
index d5706e34786..1f4dcd8593d 100644
--- a/be/src/vec/exec/scan/vmeta_scanner.cpp
+++ b/be/src/vec/exec/scan/vmeta_scanner.cpp
@@ -24,6 +24,7 @@
 #include <gen_cpp/PaloInternalService_types.h>
 #include <gen_cpp/PlanNodes_types.h>
 
+#include <algorithm>
 #include <ostream>
 #include <string>
 #include <utility>
@@ -83,6 +84,17 @@ Status VMetaScanner::prepare(RuntimeState* state, const 
VExprContextSPtrs& conju
     VLOG_CRITICAL << "VMetaScanner::prepare";
     RETURN_IF_ERROR(VScanner::prepare(_state, conjuncts));
     _tuple_desc = state->desc_tbl().get_tuple_descriptor(_tuple_id);
+    bool has_col_nullable =
+            std::any_of(std::begin(_tuple_desc->slots()), 
std::end(_tuple_desc->slots()),
+                        [](SlotDescriptor* slot_desc) { return 
slot_desc->is_nullable(); });
+
+    if (has_col_nullable) {
+        // We do not allow any columns to be Nullable here, since FE can not
+        // transmit a NULL value to BE, so we can not distinguish a empty 
string
+        // from a NULL value.
+        return Status::InternalError("Logical error, VMetaScanner do not allow 
ColumnNullable");
+    }
+
     RETURN_IF_ERROR(_fetch_metadata(_scan_range.meta_scan_range));
     return Status::OK();
 }
@@ -112,7 +124,7 @@ Status VMetaScanner::_get_block_impl(RuntimeState* state, 
Block* block, bool* eo
             }
         }
         // fill block
-        static_cast<void>(_fill_block_with_remote_data(columns));
+        RETURN_IF_ERROR(_fill_block_with_remote_data(columns));
         if (_meta_eos == true) {
             if (block->rows() == 0) {
                 *eof = true;
@@ -146,11 +158,9 @@ Status VMetaScanner::_fill_block_with_remote_data(const 
std::vector<MutableColum
         }
 
         for (int _row_idx = 0; _row_idx < _batch_data.size(); _row_idx++) {
+            // No need to check nullable column since no nullable column is
+            // guaranteed in VMetaScanner::prepare
             vectorized::IColumn* col_ptr = columns[col_idx].get();
-            if (slot_desc->is_nullable() == true) {
-                auto* nullable_column = 
reinterpret_cast<vectorized::ColumnNullable*>(col_ptr);
-                col_ptr = &nullable_column->get_nested_column();
-            }
             switch (slot_desc->type().type) {
             case TYPE_BOOLEAN: {
                 bool data = 
_batch_data[_row_idx].column_value[col_idx].boolVal;
diff --git a/docs/en/docs/sql-manual/sql-functions/table-functions/queries.md 
b/docs/en/docs/sql-manual/sql-functions/table-functions/queries.md
index 26527c39685..ebc2cb3ebe4 100644
--- a/docs/en/docs/sql-manual/sql-functions/table-functions/queries.md
+++ b/docs/en/docs/sql-manual/sql-functions/table-functions/queries.md
@@ -51,11 +51,11 @@ mysql> desc function queries();
 +------------------+--------+------+-------+---------+-------+
 | QueryId          | TEXT   | No   | false | NULL    | NONE  |
 | StartTime        | BIGINT | No   | false | NULL    | NONE  |
-| EndTime          | BIGINT | Yes  | false | NULL    | NONE  |
-| EventTime        | BIGINT | Yes  | false | NULL    | NONE  |
+| EndTime          | BIGINT | No   | false | NULL    | NONE  |
+| EventTime        | BIGINT | No   | false | NULL    | NONE  |
 | Latency          | BIGINT | No   | false | NULL    | NONE  |
 | State            | TEXT   | No   | false | NULL    | NONE  |
-| Database         | TEXT   | Yes  | false | NULL    | NONE  |
+| Database         | TEXT   | No   | false | NULL    | NONE  |
 | Sql              | TEXT   | No   | false | NULL    | NONE  |
 | FrontendInstance | TEXT   | No   | false | NULL    | NONE  |
 +------------------+--------+------+-------+---------+-------+
diff --git 
a/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/queries.md 
b/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/queries.md
index cdfd3e75fd2..e3f22da7ad5 100644
--- a/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/queries.md
+++ b/docs/zh-CN/docs/sql-manual/sql-functions/table-functions/queries.md
@@ -51,11 +51,11 @@ mysql> desc function queries();
 +------------------+--------+------+-------+---------+-------+
 | QueryId          | TEXT   | No   | false | NULL    | NONE  |
 | StartTime        | BIGINT | No   | false | NULL    | NONE  |
-| EndTime          | BIGINT | Yes  | false | NULL    | NONE  |
-| EventTime        | BIGINT | Yes  | false | NULL    | NONE  |
+| EndTime          | BIGINT | No   | false | NULL    | NONE  |
+| EventTime        | BIGINT | No   | false | NULL    | NONE  |
 | Latency          | BIGINT | No   | false | NULL    | NONE  |
 | State            | TEXT   | No   | false | NULL    | NONE  |
-| Database         | TEXT   | Yes  | false | NULL    | NONE  |
+| Database         | TEXT   | No   | false | NULL    | NONE  |
 | Sql              | TEXT   | No   | false | NULL    | NONE  |
 | FrontendInstance | TEXT   | No   | false | NULL    | NONE  |
 +------------------+--------+------+-------+---------+-------+
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/QueriesTableValuedFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/QueriesTableValuedFunction.java
index 77aeed6c89e..e6004cfb62c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/QueriesTableValuedFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/QueriesTableValuedFunction.java
@@ -37,11 +37,11 @@ public class QueriesTableValuedFunction extends 
MetadataTableValuedFunction {
     private static final ImmutableList<Column> SCHEMA = ImmutableList.of(
         new Column("QueryId", ScalarType.createStringType()),
         new Column("StartTime", PrimitiveType.BIGINT),
-        new Column("EndTime", PrimitiveType.BIGINT, true),
-        new Column("EventTime", PrimitiveType.BIGINT, true),
+        new Column("EndTime", PrimitiveType.BIGINT),
+        new Column("EventTime", PrimitiveType.BIGINT),
         new Column("Latency", PrimitiveType.BIGINT),
         new Column("State", ScalarType.createStringType()),
-        new Column("Database", ScalarType.createStringType(), true),
+        new Column("Database", ScalarType.createStringType()),
         new Column("Sql", ScalarType.createStringType()),
         new Column("FrontendInstance", ScalarType.createStringType()));
 


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

Reply via email to