This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 5d3de2fc6fe529b90fcf3cecd4724456d9c167a4 Author: Riza Suminto <riza.sumi...@cloudera.com> AuthorDate: Tue Jul 1 20:58:44 2025 -0700 IMPALA-14195: Fix test_execute_remove_orphan_files failed at Ozone test_execute_remove_orphan_files failed in Ozone build for not getting the correct table path. This patch fix the issue by defining TABLE_PATH = '{0}/{1}.db/{2}'.format( WAREHOUSE, unique_database, tbl_name) Other path assertions are also modified to use os.path.join. Testing: Run and pass test_execute_remove_orphan_files at Ozone. Change-Id: I2aba4f464ef472ab8f9d8ff7db7b5fb31a735478 Reviewed-on: http://gerrit.cloudera.org:8080/23114 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> --- tests/query_test/test_iceberg.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/query_test/test_iceberg.py b/tests/query_test/test_iceberg.py index 316885249..8fc06738e 100644 --- a/tests/query_test/test_iceberg.py +++ b/tests/query_test/test_iceberg.py @@ -463,7 +463,7 @@ class TestIcebergTable(IcebergTestSuite): def test_execute_remove_orphan_files(self, unique_database): tbl_name = 'tbl_with_orphan_files' - db_tbl = unique_database + ".tbl_with_orphan_files" + db_tbl = unique_database + "." + tbl_name with self.create_impala_client() as impalad_client: impalad_client.execute("create table {0} (i int) stored as iceberg" .format(db_tbl)) @@ -475,10 +475,9 @@ class TestIcebergTable(IcebergTestSuite): assert result.data == ['1', '2', '3'] # Add some junk files to data and metadata dir. - DATA_PATH = "/test-warehouse/{0}.db/{1}/data/".format( - unique_database, tbl_name) - METADATA_PATH = "/test-warehouse/{0}.db/{1}/metadata/".format( - unique_database, tbl_name) + TABLE_PATH = '{0}/{1}.db/{2}'.format(WAREHOUSE, unique_database, tbl_name) + DATA_PATH = os.path.join(TABLE_PATH, "data") + METADATA_PATH = os.path.join(TABLE_PATH, "metadata") SRC_DIR = os.path.join( os.environ['IMPALA_HOME'], "testdata/data/iceberg_test/iceberg_mixed_file_format_test/{0}/{1}") @@ -491,8 +490,8 @@ class TestIcebergTable(IcebergTestSuite): SRC_DIR.format('data', file_parq1), DATA_PATH) self.filesystem_client.copy_from_local( SRC_DIR.format('metadata', file_avro1), METADATA_PATH) - assert self.filesystem_client.exists(DATA_PATH + file_parq1) - assert self.filesystem_client.exists(METADATA_PATH + file_avro1) + assert self.filesystem_client.exists(os.path.join(DATA_PATH, file_parq1)) + assert self.filesystem_client.exists(os.path.join(METADATA_PATH, file_avro1)) # Keep current time. result = impalad_client.execute('select cast(now() as string)') cp1_time = result.data[0] @@ -506,24 +505,24 @@ class TestIcebergTable(IcebergTestSuite): SRC_DIR.format('data', file_parq2), DATA_PATH) self.filesystem_client.copy_from_local( SRC_DIR.format('metadata', file_avro2), METADATA_PATH) - assert self.filesystem_client.exists(DATA_PATH + file_parq2) - assert self.filesystem_client.exists(METADATA_PATH + file_avro2) + assert self.filesystem_client.exists(os.path.join(DATA_PATH, file_parq2)) + assert self.filesystem_client.exists(os.path.join(METADATA_PATH, file_avro2)) # Execute REMOVE_ORPHAN_FILES at specific timestamp. result = impalad_client.execute( "ALTER TABLE {0} EXECUTE REMOVE_ORPHAN_FILES('{1}')".format(db_tbl, cp1_time)) assert result.data[0] == 'Remove orphan files executed.' - assert not self.filesystem_client.exists(DATA_PATH + file_parq1) - assert not self.filesystem_client.exists(METADATA_PATH + file_parq1) - assert self.filesystem_client.exists(DATA_PATH + file_parq2) - assert self.filesystem_client.exists(METADATA_PATH + file_avro2) + assert not self.filesystem_client.exists(os.path.join(DATA_PATH, file_parq1)) + assert not self.filesystem_client.exists(os.path.join(METADATA_PATH, file_parq1)) + assert self.filesystem_client.exists(os.path.join(DATA_PATH, file_parq2)) + assert self.filesystem_client.exists(os.path.join(METADATA_PATH, file_avro2)) # Execute REMOVE_ORPHAN_FILES at now(). result = impalad_client.execute( "ALTER TABLE {0} EXECUTE REMOVE_ORPHAN_FILES(now())".format(db_tbl)) assert result.data[0] == 'Remove orphan files executed.' - assert not self.filesystem_client.exists(DATA_PATH + file_parq2) - assert not self.filesystem_client.exists(METADATA_PATH + file_parq2) + assert not self.filesystem_client.exists(os.path.join(DATA_PATH, file_parq2)) + assert not self.filesystem_client.exists(os.path.join(METADATA_PATH, file_parq2)) # Assert table still queryable. result = impalad_client.execute('select i from {} order by i'.format(db_tbl))