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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 20cf56d6b2 [Fix](multi catalog)Fix Iceberg table query return NULL 
bug. (#19499)
20cf56d6b2 is described below

commit 20cf56d6b2539bef90e1c0dc8092e24ff275172d
Author: Jibing-Li <64681310+jibing...@users.noreply.github.com>
AuthorDate: Thu May 11 07:48:16 2023 +0800

    [Fix](multi catalog)Fix Iceberg table query return NULL bug. (#19499)
    
    For Iceberg External Table, FE need to set Column unique id correctly to 
handle schema change case.
    This pr is to set the unique id of Column correctly, this will solve the 
query result return NULL bug.
---
 .../org/apache/doris/catalog/external/IcebergExternalTable.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/IcebergExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/IcebergExternalTable.java
index 21c27bb280..faf0ef3e0b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/IcebergExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/IcebergExternalTable.java
@@ -28,6 +28,7 @@ import org.apache.doris.thrift.TTableDescriptor;
 import org.apache.doris.thrift.TTableType;
 
 import com.google.common.collect.Lists;
+import org.apache.iceberg.Schema;
 import org.apache.iceberg.types.Types;
 
 import java.util.HashMap;
@@ -52,13 +53,13 @@ public class IcebergExternalTable extends ExternalTable {
 
     @Override
     public List<Column> initSchema() {
-        List<Types.NestedField> columns = ((IcebergExternalCatalog) 
catalog).getIcebergTable(dbName, name).schema()
-                .columns();
+        Schema schema = ((IcebergExternalCatalog) 
catalog).getIcebergTable(dbName, name).schema();
+        List<Types.NestedField> columns = schema.columns();
         List<Column> tmpSchema = 
Lists.newArrayListWithCapacity(columns.size());
         for (Types.NestedField field : columns) {
             tmpSchema.add(new Column(field.name(),
-                    icebergTypeToDorisType(field.type()), true, null,
-                    true, field.doc(), true, -1));
+                    icebergTypeToDorisType(field.type()), true, null, true, 
field.doc(), true,
+                    schema.caseInsensitiveFindField(field.name()).fieldId()));
         }
         return tmpSchema;
     }


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

Reply via email to