Skip to content

Antalya 25.3: Backport of #82301 - Filter columns in response from AWSGlue #877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: antalya-25.3
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/Databases/DataLake/GlueCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ void GlueCatalog::getTableMetadata(
{
const auto column_params = column.GetParameters();
bool can_be_nullable = column_params.contains("iceberg.field.optional") && column_params.at("iceberg.field.optional") == "true";

/// Skip field if it's not "current" (for example Renamed). No idea how someone can utilize "non current fields" but for some reason
/// they are returned by Glue API. So if you do "RENAME COLUMN a to new_a" glue will return two fields: a and new_a.
/// And a will be marked as "non current" field.
if (column_params.contains("iceberg.field.current") && column_params.at("iceberg.field.current") == "false")
continue;

schema.push_back({column.GetName(), getType(column.GetType(), can_be_nullable)});
}
result.setSchema(schema);
Expand Down
40 changes: 40 additions & 0 deletions tests/integration/test_database_glue/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,43 @@ def test_hide_sensitive_info(started_cluster):
)
assert "SECRET_1" not in node.query(f"SHOW CREATE DATABASE {CATALOG_NAME}")
assert "SECRET_2" not in node.query(f"SHOW CREATE DATABASE {CATALOG_NAME}")


def test_select_after_rename(started_cluster):
node = started_cluster.instances["node1"]

test_ref = f"test_list_tables_{uuid.uuid4()}"
table_name = f"{test_ref}_table"
root_namespace = f"{test_ref}_namespace"

namespaces_to_create = [
root_namespace,
f"{root_namespace}_A",
f"{root_namespace}_B",
f"{root_namespace}_C",
]

catalog = load_catalog_impl(started_cluster)

for namespace in namespaces_to_create:
catalog.create_namespace(namespace)
assert len(catalog.list_tables(namespace)) == 0

for namespace in namespaces_to_create:
table = create_table(catalog, namespace, table_name)

num_rows = 10
df = generate_arrow_data(num_rows)
table.append(df)

create_clickhouse_glue_database(started_cluster, node, CATALOG_NAME)

expected = DEFAULT_CREATE_TABLE.format(CATALOG_NAME, namespace, table_name)
assert expected == node.query(
f"SHOW CREATE TABLE {CATALOG_NAME}.`{namespace}.{table_name}`"
)

with table.update_schema() as update:
update.rename_column("bid", "new_bid")

print(node.query(f"SELECT * FROM {CATALOG_NAME}.`{namespace}.{table_name}`"))
Loading