Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,61 +22,66 @@ suite("test_iceberg_create_table", "p0,external,doris,external_docker,external_d
return
}

String[][] ret = sql """ show variables like 'enable_fallback_to_original_planner' """
String origin_fallback = ret[0][1]
String[][] ret = sql"""show variables like 'enable_fallback_to_original_planner';"""
boolean need_set_false = ret.size() == 1 && ret[0][1] == "true"
if (need_set_false) {
sql """ set enable_fallback_to_original_planner=false; """
}

sql """ set enable_fallback_to_original_planner=false; """
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 catalog_name = "test_iceberg_create_table"

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 catalog_name = "test_iceberg_create_table"
sql """drop catalog if exists ${catalog_name}"""
sql """
CREATE CATALOG ${catalog_name} 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"
);"""

sql """drop catalog if exists ${catalog_name}"""
sql """
CREATE CATALOG ${catalog_name} 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"
);"""
sql """ switch ${catalog_name} """

sql """ switch ${catalog_name} """
String db1 = catalog_name + "_db1"
String tb1 = db1 + "_tb1"
String tb2 = db1 + "_tb2"

String db1 = catalog_name + "_db1"
String tb1 = db1 + "_tb1"
String tb2 = db1 + "_tb2"
sql """ drop table if exists ${db1}.${tb1} """
sql """ drop table if exists ${db1}.${tb2} """
sql """ drop database if exists ${db1} """

sql """ drop table if exists ${db1}.${tb1} """
sql """ drop table if exists ${db1}.${tb2} """
sql """ drop database if exists ${db1} """
sql """ create database ${db1} """

sql """ create database ${db1} """
test {
sql """ create table ${db1}.${tb1} (id int) engine = olap """
exception "Cannot create olap table out of internal catalog. Make sure 'engine' type is specified when use the catalog: ${catalog_name}"
}

test {
sql """ create table ${db1}.${tb1} (id int) engine = olap """
exception "Cannot create olap table out of internal catalog. Make sure 'engine' type is specified when use the catalog: ${catalog_name}"
}
test {
sql """ create table ${db1}.${tb1} (id int) engine = hive """
exception "java.sql.SQLException: errCode = 2, detailMessage = Iceberg type catalog can only use `iceberg` engine."
}

test {
sql """ create table ${db1}.${tb1} (id int) engine = hive """
exception "java.sql.SQLException: errCode = 2, detailMessage = Iceberg type catalog can only use `iceberg` engine."
}
test {
sql """ create table ${db1}.${tb1} (id int) engine = jdbc """
exception "java.sql.SQLException: errCode = 2, detailMessage = Iceberg type catalog can only use `iceberg` engine."
}

test {
sql """ create table ${db1}.${tb1} (id int) engine = jdbc """
exception "java.sql.SQLException: errCode = 2, detailMessage = Iceberg type catalog can only use `iceberg` engine."
}
sql """ create table ${db1}.${tb1} (id int) engine = iceberg """
sql """ create table ${db1}.${tb2} (id int) """

sql """ create table ${db1}.${tb1} (id int) engine = iceberg """
sql """ create table ${db1}.${tb2} (id int) """

sql """ drop table ${db1}.${tb1} """
sql """ drop table ${db1}.${tb2} """
sql """ drop database ${db1} """

sql """ set enable_fallback_to_original_planner=${origin_fallback}; """
sql """ drop table ${db1}.${tb1} """
sql """ drop table ${db1}.${tb2} """
sql """ drop database ${db1} """
} finally {
if (need_set_false) {
sql """ set enable_fallback_to_original_planner=true; """
}
}
}