You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by la...@apache.org on 2022/06/20 18:50:15 UTC

[impala] 02/05: IMPALA-11356: Fix test_sfs.py to account for new Hive behavior

This is an automated email from the ASF dual-hosted git repository.

laszlog pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit d12d4c9b077392f58701af2e343dd927fe516846
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Fri Jan 28 15:28:14 2022 -0800

    IMPALA-11356: Fix test_sfs.py to account for new Hive behavior
    
    Hive changed behavior in HIVE-24920 to allow external SFS tables to
    point to locations in managed tables. test_sfs.py had a test case for
    the previous failure, so it broke with this change.
    
    This changes test_sfs.py to verify the new behavior where an external
    SFS table can point to a managed location.
    
    Testing:
     - Ran test_sfs.py locally with recent GBN
    
    Change-Id: I426aacdba7afba3f3a747a4e02632d15e38c63c9
    Reviewed-on: http://gerrit.cloudera.org:8080/18618
    Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../functional-query/queries/QueryTest/sfs.test    | 68 ++++++++++++++++++++--
 1 file changed, 63 insertions(+), 5 deletions(-)

diff --git a/testdata/workloads/functional-query/queries/QueryTest/sfs.test b/testdata/workloads/functional-query/queries/QueryTest/sfs.test
index 20ba81392..ec03e5d26 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/sfs.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/sfs.test
@@ -88,18 +88,76 @@ COMPUTE STATS $DATABASE.test_tbl_02
 'Updated 1 partition(s) and 2 column(s).'
 ====
 ---- QUERY
-CREATE EXTERNAL TABLE test_tbl_03 (s STRING, i INT) STORED AS PARQUET
+CREATE EXTERNAL TABLE test_tbl_03_ext (s STRING, i INT) STORED AS PARQUET
 LOCATION 'sfs+hdfs://$INTERNAL_LISTEN_HOST:20500/test-warehouse/managed/$DATABASE.db/sfs_d3.parq/#SINGLEFILE#'
----- CATCH
-An external table's location should not be located within managed warehouse root directory
+---- RESULTS
+'Table has been created.'
 ====
 ---- QUERY
-CREATE EXTERNAL TABLE test_tbl_04 (s STRING, i INT)
+CREATE EXTERNAL TABLE test_tbl_04_ext (s STRING, i INT)
 ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
 STORED AS TEXTFILE
 LOCATION 'sfs+hdfs://$INTERNAL_LISTEN_HOST:20500/test-warehouse/managed/$DATABASE.db/sfs_d4.txt/#SINGLEFILE#'
+---- RESULTS
+'Table has been created.'
+====
+---- QUERY
+# test_tbl_03_ext is considered as an external table. The associated single file will not be deleted
+# after the table is dropped.
+DESCRIBE FORMATTED test_tbl_03_ext
+---- RESULTS: VERIFY_IS_SUBSET
+'Table Type:         ','EXTERNAL_TABLE      ','NULL'
+'','EXTERNAL            ','TRUE                '
+---- TYPES
+STRING,STRING,STRING
+====
+---- QUERY
+# test_tbl_04_ext is considered as an external table. The associated single file will not be deleted
+# after the table is dropped.
+DESCRIBE FORMATTED test_tbl_04_ext
+---- RESULTS: VERIFY_IS_SUBSET
+'Table Type:         ','EXTERNAL_TABLE      ','NULL'
+'','EXTERNAL            ','TRUE                '
+---- TYPES
+STRING,STRING,STRING
+====
+---- QUERY
+# The contents of the table can be correctly retrieved.
+SELECT * FROM test_tbl_03_ext;
+---- RESULTS
+'a',1
+'b',2
+'c',3
+'d',4
+'e',5
+---- TYPES
+STRING, INT
+====
+---- QUERY
+# The contents of the table can be correctly retrieved.
+SELECT * FROM test_tbl_04_ext;
+---- RESULTS
+'u',1
+'v',2
+'w',3
+'x',4
+'y',5
+---- TYPES
+STRING, INT
+====
+---- QUERY
+INSERT INTO TABLE test_tbl_03_ext VALUES ('x', 100);
 ---- CATCH
-An external table's location should not be located within managed warehouse root directory
+row_regex: .*Unable to INSERT into target table .+ because .+ is not a supported filesystem.*
+====
+---- QUERY
+INSERT INTO TABLE test_tbl_04_ext VALUES ('x', 100);
+---- CATCH
+row_regex: .*Unable to INSERT into target table .+ because .+ is not a supported filesystem.*
+====
+---- QUERY
+DROP TABLE test_tbl_03_ext;
+DROP TABLE test_tbl_04_ext;
 ====
 ---- QUERY
 # The table can actually be created.