Skip to content

Commit d1efd35

Browse files
committed
add test for newest Iceberg resolution-priority changes
1 parent 715f434 commit d1efd35

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/jsoniq/jars/rumbledb-2.0.8.jar

2.37 KB
Binary file not shown.

tests/test_catalogs_update.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,47 @@ def test_multiple_catalogs(self):
122122
self.rumble,
123123
f'iceberg-table("{iceberg_custom_table.split(".", 1)[1]}")'
124124
)
125+
126+
def test_resolution_order(self):
127+
"""
128+
Matches Iceberg's catalog/namespace resolution order for spark.table().
129+
Ensures unqualified access fails when spark_catalog is not Iceberg.
130+
"""
131+
suffix = uuid.uuid4().hex
132+
table_name = f"iceberg.default.iceberg_res_{suffix}"
133+
short_name = f"iceberg_res_{suffix}"
134+
multi_ns_table = f"iceberg.ns1.ns2.iceberg_res_{suffix}_ns"
135+
136+
self._create_insert_count(
137+
self.rumble,
138+
f'create collection iceberg-table("{table_name}") with {{"k": 1}}',
139+
f'insert {{"k": 2}} last into collection iceberg-table("{table_name}")',
140+
f'count(iceberg-table("{table_name}"))'
141+
)
142+
143+
# catalog.table -> catalog.currentNamespace.table
144+
self._create_insert_count(
145+
self.rumble,
146+
f'create collection iceberg-table("iceberg.{short_name}_2") with {{"k": 1}}',
147+
f'insert {{"k": 2}} last into collection iceberg-table("iceberg.{short_name}_2")',
148+
f'count(iceberg-table("iceberg.{short_name}_2"))'
149+
)
150+
151+
# catalog.namespace1.namespace2.table -> catalog.namespace1.namespace2.table
152+
self._create_insert_count(
153+
self.rumble,
154+
f'create collection iceberg-table("{multi_ns_table}") with {{"k": 1}}',
155+
f'insert {{"k": 2}} last into collection iceberg-table("{multi_ns_table}")',
156+
f'count(iceberg-table("{multi_ns_table}"))'
157+
)
158+
159+
# namespace.table (current catalog) should fail because spark_catalog is not Iceberg here.
160+
self._assert_query_fails(
161+
self.rumble,
162+
f'iceberg-table("default.{short_name}")'
163+
)
164+
# table (current catalog + namespace) should also fail for the same reason.
165+
self._assert_query_fails(
166+
self.rumble,
167+
f'iceberg-table("{short_name}")'
168+
)

0 commit comments

Comments
 (0)