This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new f10b0d4c23e branch-3.1: [fix](iceberg) use the remote name when
request meta data from external system #52331 (#52963)
f10b0d4c23e is described below
commit f10b0d4c23e9876c8cb57afe6cd8868e1ad96fee
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Jul 8 19:48:28 2025 -0700
branch-3.1: [fix](iceberg) use the remote name when request meta data from
external system #52331 (#52963)
bp #52331
Co-authored-by: kang <[email protected]>
Co-authored-by: lik40 <[email protected]>
---
.../apache/doris/datasource/ExternalDatabase.java | 2 +-
.../org/apache/doris/datasource/ExternalTable.java | 8 +-
.../doris/datasource/hive/IcebergDlaTable.java | 14 +-
.../datasource/iceberg/IcebergExternalTable.java | 39 ++--
.../iceberg/source/IcebergApiSource.java | 4 +-
.../iceberg/source/IcebergHMSSource.java | 2 +-
.../commands/insert/IcebergInsertExecutor.java | 8 +-
.../iceberg/test_iceberg_case_sensibility.out | Bin 0 -> 1357 bytes
.../iceberg/test_iceberg_case_sensibility.groovy | 218 +++++++++++++++++++++
9 files changed, 259 insertions(+), 36 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java
index 7a32c22d9c6..f402d598498 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java
@@ -506,7 +506,7 @@ public abstract class ExternalDatabase<T extends
ExternalTable>
}
public String getRemoteName() {
- return remoteName;
+ return Strings.isNullOrEmpty(remoteName) ? name : remoteName;
}
@Override
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalTable.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalTable.java
index d6b41544201..bdeb31b3559 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalTable.java
@@ -43,6 +43,7 @@ import org.apache.doris.statistics.util.StatisticsUtil;
import org.apache.doris.thrift.TTableDescriptor;
import com.google.common.base.Objects;
+import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.collections.CollectionUtils;
@@ -157,7 +158,7 @@ public class ExternalTable implements TableIf, Writable,
GsonPostProcessable {
}
public String getRemoteName() {
- return remoteName;
+ return Strings.isNullOrEmpty(remoteName) ? name : remoteName;
}
@Override
@@ -493,6 +494,11 @@ public class ExternalTable implements TableIf, Writable,
GsonPostProcessable {
return dbName;
}
+ public String getRemoteDbName() {
+ return db.getRemoteName();
+ }
+
+
public TableAttributes getTableAttributes() {
return tableAttributes;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/IcebergDlaTable.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/IcebergDlaTable.java
index 36b871282a9..6c5db2689b7 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/IcebergDlaTable.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/IcebergDlaTable.java
@@ -54,7 +54,7 @@ public class IcebergDlaTable extends HMSDlaTable {
public Map<String, PartitionItem>
getAndCopyPartitionItems(Optional<MvccSnapshot> snapshot) {
return Maps.newHashMap(
IcebergUtils.getOrFetchSnapshotCacheValue(
- snapshot, hmsTable.getCatalog(), hmsTable.getDbName(),
hmsTable.getName())
+ snapshot, hmsTable.getCatalog(),
hmsTable.getRemoteDbName(), hmsTable.getRemoteName())
.getPartitionInfo().getNameToPartitionItem());
}
@@ -72,9 +72,9 @@ public class IcebergDlaTable extends HMSDlaTable {
public List<Column> getPartitionColumns(Optional<MvccSnapshot> snapshot) {
IcebergSnapshotCacheValue snapshotValue =
IcebergUtils.getOrFetchSnapshotCacheValue(
- snapshot, hmsTable.getCatalog(), hmsTable.getDbName(),
hmsTable.getName());
+ snapshot, hmsTable.getCatalog(),
hmsTable.getRemoteDbName(), hmsTable.getRemoteName());
IcebergSchemaCacheValue schemaValue = IcebergUtils.getSchemaCacheValue(
- hmsTable.getCatalog(), hmsTable.getDbName(),
hmsTable.getName(),
+ hmsTable.getCatalog(), hmsTable.getRemoteDbName(),
hmsTable.getRemoteName(),
snapshotValue.getSnapshot().getSchemaId());
return schemaValue.getPartitionColumns();
}
@@ -84,7 +84,7 @@ public class IcebergDlaTable extends HMSDlaTable {
Optional<MvccSnapshot>
snapshot) throws AnalysisException {
IcebergSnapshotCacheValue snapshotValue =
IcebergUtils.getOrFetchSnapshotCacheValue(
- snapshot, hmsTable.getCatalog(), hmsTable.getDbName(),
hmsTable.getName());
+ snapshot, hmsTable.getCatalog(),
hmsTable.getRemoteDbName(), hmsTable.getRemoteName());
long latestSnapshotId =
snapshotValue.getPartitionInfo().getLatestSnapshotId(partitionName);
if (latestSnapshotId <= 0) {
throw new AnalysisException("can not find partition: " +
partitionName);
@@ -98,7 +98,7 @@ public class IcebergDlaTable extends HMSDlaTable {
hmsTable.makeSureInitialized();
IcebergSnapshotCacheValue snapshotValue =
IcebergUtils.getOrFetchSnapshotCacheValue(
- snapshot, hmsTable.getCatalog(), hmsTable.getDbName(),
hmsTable.getName());
+ snapshot, hmsTable.getCatalog(),
hmsTable.getRemoteDbName(), hmsTable.getRemoteName());
return new
MTMVSnapshotIdSnapshot(snapshotValue.getSnapshot().getSnapshotId());
}
@@ -116,8 +116,8 @@ public class IcebergDlaTable extends HMSDlaTable {
Set<String> allFields = Sets.newHashSet();
Table table = IcebergUtils.getIcebergTable(
hmsTable.getCatalog(),
- hmsTable.getDbName(),
- hmsTable.getName()
+ hmsTable.getRemoteDbName(),
+ hmsTable.getRemoteName()
);
for (PartitionSpec spec : table.specs().values()) {
if (spec == null) {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
index bb947385f3b..7eb66988f36 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
@@ -85,7 +85,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
super.makeSureInitialized();
if (!objectCreated) {
objectCreated = true;
- isView = catalog.viewExists(dbName, getRemoteName());
+ isView = catalog.viewExists(getRemoteDbName(), getRemoteName());
}
}
@@ -97,24 +97,23 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
@Override
public Optional<SchemaCacheValue> initSchema(SchemaCacheKey key) {
boolean isView = isView();
- String tableName = getRemoteName();
return IcebergUtils.loadSchemaCacheValue(
- catalog, dbName, tableName, ((IcebergSchemaCacheKey)
key).getSchemaId(), isView);
+ getCatalog(), getRemoteDbName(), getRemoteName(),
((IcebergSchemaCacheKey) key).getSchemaId(), isView);
}
@Override
public TTableDescriptor toThrift() {
List<Column> schema = getFullSchema();
if (getIcebergCatalogType().equals("hms")) {
- THiveTable tHiveTable = new THiveTable(dbName, name, new
HashMap<>());
+ THiveTable tHiveTable = new THiveTable(getDbName(), getName(), new
HashMap<>());
TTableDescriptor tTableDescriptor = new TTableDescriptor(getId(),
TTableType.HIVE_TABLE, schema.size(), 0,
- getName(), dbName);
+ getName(), getDbName());
tTableDescriptor.setHiveTable(tHiveTable);
return tTableDescriptor;
} else {
- TIcebergTable icebergTable = new TIcebergTable(dbName, name, new
HashMap<>());
+ TIcebergTable icebergTable = new TIcebergTable(getDbName(),
getName(), new HashMap<>());
TTableDescriptor tTableDescriptor = new TTableDescriptor(getId(),
TTableType.ICEBERG_TABLE,
- schema.size(), 0, getName(), dbName);
+ schema.size(), 0, getName(), getDbName());
tTableDescriptor.setIcebergTable(icebergTable);
return tTableDescriptor;
}
@@ -129,12 +128,12 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
@Override
public long fetchRowCount() {
makeSureInitialized();
- long rowCount = IcebergUtils.getIcebergRowCount(getCatalog(),
getDbName(), getName());
+ long rowCount = IcebergUtils.getIcebergRowCount(getCatalog(),
getRemoteDbName(), getRemoteName());
return rowCount > 0 ? rowCount : UNKNOWN_ROW_COUNT;
}
public Table getIcebergTable() {
- return IcebergUtils.getIcebergTable(getCatalog(), getDbName(),
getName());
+ return IcebergUtils.getIcebergTable(getCatalog(), getRemoteDbName(),
getRemoteName());
}
@Override
@@ -144,13 +143,13 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
@Override
public Map<String, PartitionItem>
getAndCopyPartitionItems(Optional<MvccSnapshot> snapshot) {
return Maps.newHashMap(
- IcebergUtils.getOrFetchSnapshotCacheValue(snapshot, getCatalog(),
getDbName(), getName())
+ IcebergUtils.getOrFetchSnapshotCacheValue(snapshot, getCatalog(),
getRemoteDbName(), getRemoteName())
.getPartitionInfo().getNameToPartitionItem());
}
@Override
public Map<String, PartitionItem>
getNameToPartitionItems(Optional<MvccSnapshot> snapshot) {
- return IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getDbName(), getName())
+ return IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getRemoteDbName(), getRemoteName())
.getPartitionInfo().getNameToPartitionItem();
}
@@ -167,9 +166,9 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
@Override
public List<Column> getPartitionColumns(Optional<MvccSnapshot> snapshot) {
IcebergSnapshotCacheValue snapshotValue =
- IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getDbName(), getName());
+ IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getRemoteDbName(), getRemoteName());
IcebergSchemaCacheValue schemaValue = IcebergUtils.getSchemaCacheValue(
- catalog, getDbName(), getName(),
snapshotValue.getSnapshot().getSchemaId());
+ getCatalog(), getRemoteDbName(), getRemoteName(),
snapshotValue.getSnapshot().getSchemaId());
return schemaValue.getPartitionColumns();
}
@@ -177,7 +176,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
public MTMVSnapshotIf getPartitionSnapshot(String partitionName,
MTMVRefreshContext context,
Optional<MvccSnapshot>
snapshot) throws AnalysisException {
IcebergSnapshotCacheValue snapshotValue =
- IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getDbName(), getName());
+ IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getRemoteDbName(), getRemoteName());
long latestSnapshotId =
snapshotValue.getPartitionInfo().getLatestSnapshotId(partitionName);
if (latestSnapshotId <= 0) {
throw new AnalysisException("can not find partition: " +
partitionName);
@@ -190,7 +189,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
throws AnalysisException {
makeSureInitialized();
IcebergSnapshotCacheValue snapshotValue =
- IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getDbName(), getName());
+ IcebergUtils.getOrFetchSnapshotCacheValue(snapshot,
getCatalog(), getRemoteDbName(), getRemoteName());
return new
MTMVSnapshotIdSnapshot(snapshotValue.getSnapshot().getSnapshotId());
}
@@ -245,13 +244,13 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
return new EmptyMvccSnapshot();
} else {
return new
IcebergMvccSnapshot(IcebergUtils.getIcebergSnapshotCacheValue(
- tableSnapshot, getCatalog(), getDbName(), getName(),
scanParams));
+ tableSnapshot, getCatalog(), getRemoteDbName(),
getRemoteName(), scanParams));
}
}
@Override
public List<Column> getFullSchema() {
- return IcebergUtils.getIcebergSchema(this, getCatalog(), getDbName(),
getName());
+ return IcebergUtils.getIcebergSchema(this, getCatalog(),
getRemoteDbName(), getRemoteName());
}
@Override
@@ -288,7 +287,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
public String getViewText() {
try {
return catalog.getPreExecutionAuthenticator().execute(() -> {
- View icebergView = IcebergUtils.getIcebergView(getCatalog(),
dbName, getRemoteName());
+ View icebergView = IcebergUtils.getIcebergView(getCatalog(),
getRemoteDbName(), getRemoteName());
ViewVersion viewVersion = icebergView.currentVersion();
if (viewVersion == null) {
throw new RuntimeException(String.format("Cannot get view
version for view '%s'", icebergView));
@@ -315,7 +314,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
public String getSqlDialect() {
try {
return catalog.getPreExecutionAuthenticator().execute(() -> {
- View icebergView = IcebergUtils.getIcebergView(getCatalog(),
dbName, getRemoteName());
+ View icebergView = IcebergUtils.getIcebergView(getCatalog(),
getRemoteDbName(), getRemoteName());
ViewVersion viewVersion = icebergView.currentVersion();
if (viewVersion == null) {
throw new RuntimeException(String.format("Cannot get view
version for view '%s'", icebergView));
@@ -336,7 +335,7 @@ public class IcebergExternalTable extends ExternalTable
implements MTMVRelatedTa
}
public View getIcebergView() {
- return IcebergUtils.getIcebergView(getCatalog(), dbName,
getRemoteName());
+ return IcebergUtils.getIcebergView(getCatalog(), getRemoteDbName(),
getRemoteName());
}
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergApiSource.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergApiSource.java
index 8ba1d71c1cb..7915fec1743 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergApiSource.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergApiSource.java
@@ -57,8 +57,8 @@ public class IcebergApiSource implements IcebergSource {
this.originTable =
Env.getCurrentEnv().getExtMetaCacheMgr().getIcebergMetadataCache().getIcebergTable(
icebergExtTable.getCatalog(),
- icebergExtTable.getDbName(),
- icebergExtTable.getName());
+ icebergExtTable.getRemoteDbName(),
+ icebergExtTable.getRemoteName());
this.desc = desc;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergHMSSource.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergHMSSource.java
index 531f4e4ae3c..5fc6b400d1c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergHMSSource.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/source/IcebergHMSSource.java
@@ -44,7 +44,7 @@ public class IcebergHMSSource implements IcebergSource {
this.icebergTable =
Env.getCurrentEnv().getExtMetaCacheMgr().getIcebergMetadataCache()
.getIcebergTable(hmsTable.getCatalog(),
- hmsTable.getDbName(), hmsTable.getName());
+ hmsTable.getRemoteDbName(),
hmsTable.getRemoteName());
}
@Override
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/IcebergInsertExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/IcebergInsertExecutor.java
index fe8ff063571..2d08a66cd3c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/IcebergInsertExecutor.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/IcebergInsertExecutor.java
@@ -48,8 +48,8 @@ public class IcebergInsertExecutor extends
BaseExternalTableInsertExecutor {
@Override
protected void beforeExec() throws UserException {
- String dbName = ((IcebergExternalTable) table).getDbName();
- String tbName = table.getName();
+ String dbName = ((IcebergExternalTable) table).getRemoteDbName();
+ String tbName = ((IcebergExternalTable) table).getRemoteName();
SimpleTableInfo tableInfo = new SimpleTableInfo(dbName, tbName);
IcebergTransaction transaction = (IcebergTransaction)
transactionManager.getTransaction(txnId);
transaction.beginInsert(tableInfo);
@@ -57,8 +57,8 @@ public class IcebergInsertExecutor extends
BaseExternalTableInsertExecutor {
@Override
protected void doBeforeCommit() throws UserException {
- String dbName = ((IcebergExternalTable) table).getDbName();
- String tbName = table.getName();
+ String dbName = ((IcebergExternalTable) table).getRemoteDbName();
+ String tbName = ((IcebergExternalTable) table).getRemoteName();
SimpleTableInfo tableInfo = new SimpleTableInfo(dbName, tbName);
IcebergTransaction transaction = (IcebergTransaction)
transactionManager.getTransaction(txnId);
this.loadedRows = transaction.getUpdateCnt();
diff --git
a/regression-test/data/external_table_p0/iceberg/test_iceberg_case_sensibility.out
b/regression-test/data/external_table_p0/iceberg/test_iceberg_case_sensibility.out
new file mode 100644
index 00000000000..5475521a321
Binary files /dev/null and
b/regression-test/data/external_table_p0/iceberg/test_iceberg_case_sensibility.out
differ
diff --git
a/regression-test/suites/external_table_p0/iceberg/test_iceberg_case_sensibility.groovy
b/regression-test/suites/external_table_p0/iceberg/test_iceberg_case_sensibility.groovy
new file mode 100644
index 00000000000..b258a17a98b
--- /dev/null
+++
b/regression-test/suites/external_table_p0/iceberg/test_iceberg_case_sensibility.groovy
@@ -0,0 +1,218 @@
+// 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_iceberg_case_sensibility",
"p0,external,doris,external_docker,external_docker_doris") {
+ String enabled = context.config.otherConfigs.get("enableIcebergTest")
+ if (enabled != null && enabled.equalsIgnoreCase("true")) {
+ try {
+ String rest_port =
context.config.otherConfigs.get("iceberg_rest_uri_port")
+ String minio_port =
context.config.otherConfigs.get("iceberg_minio_port")
+ String externalEnvIp =
context.config.otherConfigs.get("externalEnvIp")
+ String hms_port = context.config.otherConfigs.get("hive2HmsPort")
+ String hdfs_port = context.config.otherConfigs.get("hive2HdfsPort")
+ String default_fs = "hdfs://${externalEnvIp}:${hdfs_port}"
+ String warehouse = "${default_fs}/warehouse"
+
+ // rest
+ for (String case_type : ["0", "1", "2"]) {
+ sql """drop catalog if exists
test_iceberg_case_sensibility_rest"""
+ sql """CREATE CATALOG test_iceberg_case_sensibility_rest
PROPERTIES (
+ 'type'='iceberg',
+ 'iceberg.catalog.type'='rest',
+ 'uri' = 'http://${externalEnvIp}:${rest_port}',
+ "s3.access_key" = "admin",
+ "s3.secret_key" = "password",
+ "s3.endpoint" =
"http://${externalEnvIp}:${minio_port}",
+ "s3.region" = "us-east-1",
+ "only_test_lower_case_table_names" = "${case_type}"
+ );"""
+
+ sql """ switch test_iceberg_case_sensibility_rest """
+ sql """ use test_db"""
+ sql """ drop table if exists iceberg_case_sensibility_TBL1"""
+ sql """ drop table if exists iceberg_case_sensibility_tbl2"""
+ sql """ create table iceberg_case_sensibility_TBL1(k1 int);"""
+ sql """ create table iceberg_case_sensibility_tbl2(k1 int);"""
+ sql """insert into iceberg_case_sensibility_TBL1 values(1)"""
+ sql """insert into iceberg_case_sensibility_tbl2 values(1)"""
+
+ if (case_type.equals("0")) {
+ // store in origin, query case sensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_TBL1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_TBL1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ test {
+ sql "select * from iceberg_case_sensibility_tbl1"
+ exception "does not exist in database"
+ }
+ test {
+ sql "insert into iceberg_case_sensibility_tbl1
values(1)"
+ exception "does not exist in database"
+ }
+ } else if (case_type.equals("1")) {
+ // store in lower case, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_tbl1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ } else if (case_type.equals("2")) {
+ // store in origin, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_TBL1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_tbl1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ }
+
+ // hadoop
+ sql """drop catalog if exists
test_iceberg_case_sensibility_hadoop"""
+ sql """CREATE CATALOG test_iceberg_case_sensibility_hadoop
PROPERTIES (
+ 'type'='iceberg',
+ 'iceberg.catalog.type'='hadoop',
+ 'warehouse' = 's3a://warehouse/wh',
+ "s3.access_key" = "admin",
+ "s3.secret_key" = "password",
+ "s3.endpoint" =
"http://${externalEnvIp}:${minio_port}",
+ "s3.region" = "us-east-1",
+ "only_test_lower_case_table_names" = "${case_type}"
+ );"""
+
+ sql """ switch test_iceberg_case_sensibility_hadoop """
+ sql """ drop database if exists
iceberg_case_sensibility_hadoop_db force"""
+ sql """ create database iceberg_case_sensibility_hadoop_db"""
+ sql """ use iceberg_case_sensibility_hadoop_db"""
+ sql """ drop table if exists iceberg_case_sensibility_TBL1"""
+ sql """ drop table if exists iceberg_case_sensibility_tbl2"""
+ sql """ create table iceberg_case_sensibility_TBL1(k1 int);"""
+ sql """ create table iceberg_case_sensibility_tbl2(k1 int);"""
+ sql """insert into iceberg_case_sensibility_TBL1 values(1)"""
+ sql """insert into iceberg_case_sensibility_tbl2 values(1)"""
+
+ if (case_type.equals("0")) {
+ // store in origin, query case sensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_TBL1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_TBL1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ test {
+ sql "select * from iceberg_case_sensibility_tbl1"
+ exception "does not exist in database"
+ }
+ test {
+ sql "insert into iceberg_case_sensibility_tbl1
values(1)"
+ exception "does not exist in database"
+ }
+ } else if (case_type.equals("1")) {
+ // store in lower case, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_tbl1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ } else if (case_type.equals("2")) {
+ // store in origin, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_TBL1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_tbl1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ }
+
+ // hms
+ sql """drop catalog if exists
test_iceberg_case_sensibility_hms"""
+ sql """create catalog test_iceberg_case_sensibility_hms
properties (
+ 'type'='iceberg',
+ 'iceberg.catalog.type'='hms',
+ 'hive.metastore.uris' =
'thrift://${externalEnvIp}:${hms_port}',
+ 'fs.defaultFS' = '${default_fs}',
+ 'warehouse' = '${warehouse}',
+ "only_test_lower_case_table_names" = "${case_type}"
+ );"""
+
+ sql """ switch test_iceberg_case_sensibility_hms """
+ sql """ drop database if exists
iceberg_case_sensibility_hms_db force"""
+ sql """ create database iceberg_case_sensibility_hms_db"""
+ sql """ use iceberg_case_sensibility_hms_db"""
+ sql """ drop table if exists iceberg_case_sensibility_tbl1"""
+ sql """ drop table if exists iceberg_case_sensibility_tbl2"""
+ sql """ create table iceberg_case_sensibility_TBL1(k1 int);"""
+ sql """ create table iceberg_case_sensibility_tbl2(k1 int);"""
+ sql """insert into iceberg_case_sensibility_tbl1 values(1)"""
+ sql """insert into iceberg_case_sensibility_tbl2 values(1)"""
+
+ if (case_type.equals("0")) {
+ // hms is case insensitive, so table name will be stored
in lower, query case sensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ test {
+ sql "select * from iceberg_case_sensibility_TBL1"
+ exception "does not exist in database"
+ }
+ test {
+ sql "insert into iceberg_case_sensibility_TBL1
values(1)"
+ exception "does not exist in database"
+ }
+ } else if (case_type.equals("1")) {
+ // store in lower case, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_TBL1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ } else if (case_type.equals("2")) {
+ // store in origin, query case insensitive
+ qt_sql """show tables like
"iceberg_case_sensibility_TBL1""""
+ qt_sql """show tables like
"iceberg_case_sensibility_tbl2""""
+ sql """insert into iceberg_case_sensibility_TBL1
values(2)"""
+ sql """insert into iceberg_case_sensibility_tbl2
values(2)"""
+ order_qt_sql11 """select * from
iceberg_case_sensibility_TBL1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_tbl2""";
+ order_qt_sql11 """select * from
iceberg_case_sensibility_tbl1""";
+ order_qt_sql12 """select * from
iceberg_case_sensibility_TBL2""";
+ }
+ }
+
+ } finally {
+ // sql """set enable_external_table_batch_mode=true"""
+ }
+ }
+}
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]