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

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

commit aeaedb734f7ed2db7b6f434d78a30ff15b3db8d6
Author: morrySnow <[email protected]>
AuthorDate: Fri Mar 31 13:42:24 2023 +0800

    [fix](planner) lateral view do not support lower case table name config 
(#18165)
    
    TableFunctionNode lower_case_table_names set to 1 and 2
---
 .../org/apache/doris/analysis/LateralViewRef.java  | 54 +++++++++++++---------
 .../java/org/apache/doris/analysis/TableName.java  |  4 ++
 2 files changed, 37 insertions(+), 21 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/LateralViewRef.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LateralViewRef.java
index 0b1812a6dd..522b661a62 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LateralViewRef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LateralViewRef.java
@@ -132,28 +132,40 @@ public class LateralViewRef extends TableRef {
             if (tableName == null) {
                 // t1 lateral view explode_split(k1, ",")
                 slotRef.setTblName(relatedTableName.cloneWithoutAnalyze());
-            } else if (tableName.getDb() == null && tableName.getTbl() != 
null) {
-                if (Config.lower_case_table_names != 0) {
-                    // TODO support case insensitive
-                    throw new AnalysisException("Not support specify table 
name in table function "
-                            + "when config.lower_case_table_names is not 0");
-                }
-                if (tableName.getTbl().equals(relatedTableName.getTbl())) {
-                    // t1 lateral view explode_split(t1.k1, ",")
-                    tableName.setDb(relatedTableName.getDb());
-                } else {
-                    // t1 lateral view explode_split(t2.k1, ",")
-                    throw new AnalysisException("The column " + 
slotRef.toMySql()
-                            + " in lateral view must come from the origin 
table "
-                            + relatedTableName.toSql());
-                }
-            } else {
-                if 
(!tableName.getDb().equalsIgnoreCase(relatedTableName.getDb())) {
-                    // db2.t1 lateral view explode_split(db1.t1.k1, ",")
-                    throw new AnalysisException("The column " + 
slotRef.toMySql()
-                            + " in lateral view must come from the origin 
table "
-                            + relatedTableRef.toSql());
+                return;
+            }
+            if (tableName.getDb() != null && 
!tableName.getDb().equalsIgnoreCase(relatedTableName.getDb())) {
+                // db2.t1 lateral view explode_split(db1.t1.k1, ",")
+                throw new AnalysisException("The column " + slotRef.toMySql()
+                        + " in lateral view must come from the origin table "
+                        + relatedTableRef.toSql());
+            }
+
+            if (tableName.getTbl() != null) {
+                switch (Config.lower_case_table_names) {
+                    case 0:
+                        if 
(tableName.getTbl().equals(relatedTableName.getTbl())) {
+                            // t1 lateral view explode_split(t1.k1, ",")
+                            tableName.setDb(relatedTableName.getDb());
+                            return;
+                        }
+                        break;
+                    case 1:
+                    case 2:
+                        if 
(tableName.getTbl().equalsIgnoreCase(relatedTableName.getTbl())) {
+                            tableName.setTbl(relatedTableName.getTbl());
+                            tableName.setDb(relatedTableName.getDb());
+                            return;
+                        }
+                        break;
+                    default:
+                        throw new AnalysisException("Not support specify table 
name in table function "
+                                + "when config.lower_case_table_names is not 
0, 1 or 2");
                 }
+                // t1 lateral view explode_split(t2.k1, ",")
+                throw new AnalysisException("The column " + slotRef.toMySql()
+                        + " in lateral view must come from the origin table "
+                        + relatedTableName.toSql());
             }
         }
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/TableName.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TableName.java
index b5841ea9ae..6ae8132a6d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TableName.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TableName.java
@@ -122,6 +122,10 @@ public class TableName implements Writable {
         return tbl;
     }
 
+    public void setTbl(String tbl) {
+        this.tbl = tbl;
+    }
+
     public boolean isEmpty() {
         return tbl.isEmpty();
     }


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

Reply via email to