Skip to content

Commit c615180

Browse files
committed
Fix encoding and add test
1 parent 49aa6c6 commit c615180

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/Databases/DataLake/RestCatalog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ void RestCatalog::sendRequest(const String & endpoint, Poco::JSON::Object::Ptr r
702702
};
703703
}
704704

705-
Poco::URI url(endpoint);
705+
Poco::URI url(endpoint, false);
706706
auto wb = DB::BuilderRWBufferFromHTTP(url)
707707
.withConnectionGroup(DB::HTTPConnectionGroupType::HTTP)
708708
.withMethod(method)

tests/integration/test_database_iceberg/test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ def test_create(started_cluster):
560560
node.query(f"INSERT INTO {CATALOG_NAME}.`{root_namespace}.{table_name}` VALUES ('AAPL');", settings={"allow_experimental_insert_into_iceberg": 1, 'write_full_path_in_iceberg_metadata': 1})
561561
assert node.query(f"SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`") == "AAPL\n"
562562

563+
563564
def test_drop_table(started_cluster):
564565
node = started_cluster.instances["node1"]
565566

@@ -575,3 +576,27 @@ def test_drop_table(started_cluster):
575576

576577
drop_clickhouse_iceberg_table(node, root_namespace, table_name)
577578
assert len(catalog.list_tables(root_namespace)) == 0
579+
580+
581+
def test_table_with_slash(started_cluster):
582+
node = started_cluster.instances["node1"]
583+
584+
# pyiceberg at current moment (version 0.9.1) has a bug with table names with slashes
585+
# see https://github.com/apache/iceberg-python/issues/2462
586+
# so we need to encode it manually
587+
table_raw_suffix = "table/foo"
588+
table_encoded_suffix = "table%2Ffoo"
589+
590+
test_ref = f"test_list_tables_{uuid.uuid4()}"
591+
table_name = f"{test_ref}_{table_raw_suffix}"
592+
table_encoded_name = f"{test_ref}_{table_encoded_suffix}"
593+
root_namespace = f"{test_ref}_namespace"
594+
595+
catalog = load_catalog_impl(started_cluster)
596+
catalog.create_namespace(root_namespace)
597+
598+
create_table(catalog, root_namespace, table_name, DEFAULT_SCHEMA, PartitionSpec(), DEFAULT_SORT_ORDER)
599+
600+
create_clickhouse_iceberg_database(started_cluster, node, CATALOG_NAME)
601+
node.query(f"INSERT INTO {CATALOG_NAME}.`{root_namespace}.{table_encoded_name}` VALUES (NULL, 'AAPL', 193.24, 193.31, tuple('bot'));", settings={"allow_experimental_insert_into_iceberg": 1, 'write_full_path_in_iceberg_metadata': 1})
602+
assert node.query(f"SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_encoded_name}`") == "\\N\tAAPL\t193.24\t193.31\t('bot')\n"

0 commit comments

Comments
 (0)