laserninja commented on code in PR #10500: URL: https://github.com/apache/gravitino/pull/10500#discussion_r3114912389
########## trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00013_snapshot_maintenance.sql: ########## @@ -0,0 +1,49 @@ +-- 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. + +-- Test Iceberg snapshot maintenance procedures via Gravitino connector + +CREATE SCHEMA IF NOT EXISTS gt_snapshot_test; + +CREATE TABLE gt_snapshot_test.maintenance_table ( + id int, + name varchar +); + +-- Insert data to create snapshots +INSERT INTO gt_snapshot_test.maintenance_table VALUES (1, 'alice'); + +INSERT INTO gt_snapshot_test.maintenance_table VALUES (2, 'bob'); + +INSERT INTO gt_snapshot_test.maintenance_table VALUES (3, 'charlie'); + +-- Verify we have multiple snapshots +SELECT count(*) >= 3 FROM "gt_snapshot_test"."maintenance_table$snapshots"; + +-- Test expire_snapshots procedure (delegation to inner Iceberg connector). +-- Note: remove_orphan_files, optimize, and rewrite_manifests procedures +-- return non-deterministic statistics rows (file counts vary by run), so +-- they are covered by Java unit tests instead of this SQL integration test. +ALTER TABLE gt_snapshot_test.maintenance_table EXECUTE expire_snapshots; Review Comment: Yes — the SQL integration test is intentionally limited to `expire_snapshots` because it's the only procedure that produces deterministic output with the generic `TrinoQueryIT` expected-output diff harness. `remove_orphan_files`, `optimize`, and `rewrite_manifests` return a result row with statistics (e.g. `processed_manifests_count`, `active_files_count`, `scanned_files_count`, `deleted_files_count`) whose values depend on how Iceberg happens to organize files at runtime and vary across CI runs. That made the `.txt` expected-output file inherently flaky. The delegation path for all four procedures is fully covered by unit tests in TestGravitinoConnectorProcedures.java, which assert that `getTableHandleForExecute` / `executeTableExecute` / `beginTableExecute` / `finishTableExecute` / page-sink creation are correctly routed to the internal connector for each procedure name, and that handles are properly wrapped/unwrapped. The SQL test adds end-to-end coverage for the `expire_snapshots` path through the real Iceberg connector. Happy to add non-diff assertions for the other three (e.g. verify the result row exists and has the expected columns) if you'd prefer, but that would require extending the test harness. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
