Files
impala/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file-orc.test
stiga-huang 7b44b35132 IMPALA-9351: Fix tests depending on hard-coded file paths of managed tables
Some tests (e.g. AnalyzeDDLTest.TestCreateTableLikeFileOrc) depend on
hard-coded file paths of managed tables, assuming that there is always a
file named 'base_0000001/bucket_00000_0' under the table dir. However,
the file name is in the form of bucket_${bucket-id}_${attempt-id}. The
last part of the file name is not guaranteed to be 0. If the first
attempt fails and the second attempt succeeds, the file name will be
bucket_00000_1.

This patch replaces these hard-coded file paths to corresponding files
that are uploaded to HDFS by commands. For tests that do need to use the
file paths of managed table files, we do a listing on the table dir to
get the file names, instead of hard-coding the file paths.

Updated chars-formats.orc to contain column names in the file so can be
used in more tests. The original one only has names like col0, col1,
col2.

Tests:
 - Run CORE tests

Change-Id: Ie3136ee90e2444c4a12f0f2e1470fca1d5deaba0
Reviewed-on: http://gerrit.cloudera.org:8080/16441
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-09-12 05:30:45 +00:00

132 lines
4.5 KiB
Plaintext

====
---- HIVE_QUERY
use $DATABASE;
create external table copy_decimal_tiny
stored as orc
tblproperties ('external.table.purge'='TRUE')
as select * from functional_orc_def.decimal_tiny;
====
---- QUERY
create table $DATABASE.temp_decimal_table_orc like ORC
'$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/copy_decimal_tiny/000000_0'
---- RESULTS
'Table has been created.'
====
---- QUERY
describe $DATABASE.temp_decimal_table_orc
---- RESULTS
'c1','decimal(10,4)','Inferred from ORC file.'
'c2','decimal(15,5)','Inferred from ORC file.'
'c3','decimal(1,1)','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====
---- QUERY
create table $DATABASE.temp_chars_table like ORC
'$NAMENODE/test-warehouse/chars_formats_orc_def/chars-formats.orc'
---- RESULTS
'Table has been created.'
====
---- QUERY
describe $DATABASE.temp_chars_table
---- RESULTS
'cs','char(5)','Inferred from ORC file.'
'cl','char(140)','Inferred from ORC file.'
'vc','varchar(32)','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====
---- HIVE_QUERY
use $DATABASE;
create external table copy_zipcode_incomes
stored as orc
tblproperties ('external.table.purge'='TRUE')
as select * from functional_orc_def.zipcode_incomes;
====
---- QUERY
create table $DATABASE.like_zipcodes_file_orc like ORC
'$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/copy_zipcode_incomes/000000_0'
---- RESULTS
'Table has been created.'
====
---- QUERY
describe $DATABASE.like_zipcodes_file_orc
---- RESULTS
'id','string','Inferred from ORC file.'
'zip','string','Inferred from ORC file.'
'description1','string','Inferred from ORC file.'
'description2','string','Inferred from ORC file.'
'income','int','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====
---- HIVE_QUERY
use $DATABASE;
create external table copy_alltypestiny
stored as orc
tblproperties ('external.table.purge'='TRUE')
as select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col,
double_col, date_string_col, string_col, timestamp_col
from functional_orc_def.alltypestiny;
====
---- QUERY
create table $DATABASE.like_alltypestiny_file_orc like ORC
'$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/copy_alltypestiny/000000_0'
---- RESULTS
'Table has been created.'
====
---- QUERY
describe $DATABASE.like_alltypestiny_file_orc
---- RESULTS
'id','int','Inferred from ORC file.'
'bool_col','boolean','Inferred from ORC file.'
'tinyint_col','tinyint','Inferred from ORC file.'
'smallint_col','smallint','Inferred from ORC file.'
'int_col','int','Inferred from ORC file.'
'bigint_col','bigint','Inferred from ORC file.'
'float_col','float','Inferred from ORC file.'
'double_col','double','Inferred from ORC file.'
'date_string_col','string','Inferred from ORC file.'
'string_col','string','Inferred from ORC file.'
'timestamp_col','timestamp','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====
---- QUERY
create table non_transactional_complextypes_clone like ORC
'$FILESYSTEM_PREFIX/test-warehouse/complextypestbl_non_transactional_orc_def/nullable.orc'
---- RESULTS
'Table has been created.'
====
---- QUERY
describe non_transactional_complextypes_clone
---- RESULTS
'id','bigint','Inferred from ORC file.'
'int_array','array<int>','Inferred from ORC file.'
'int_array_array','array<array<int>>','Inferred from ORC file.'
'int_map','map<string,int>','Inferred from ORC file.'
'int_map_array','array<map<string,int>>','Inferred from ORC file.'
'nested_struct','struct<\n a:int,\n b:array<int>,\n c:struct<\n d:array<array<struct<\n e:int,\n f:string\n >>>\n >,\n g:map<string,struct<\n h:struct<\n i:array<double>\n >\n >>\n>','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====
---- QUERY
create external table transactional_complextypes_clone like ORC
'$TRANSACTIONAL_COMPLEXTYPESTBL_FILE'
stored as orc;
---- RESULTS
'Table has been created.'
====
---- QUERY
describe transactional_complextypes_clone
---- RESULTS
'operation','int','Inferred from ORC file.'
'originaltransaction','bigint','Inferred from ORC file.'
'bucket','int','Inferred from ORC file.'
'rowid','bigint','Inferred from ORC file.'
'currenttransaction','bigint','Inferred from ORC file.'
'row','struct<\n id:bigint,\n int_array:array<int>,\n int_array_array:array<array<int>>,\n int_map:map<string,int>,\n int_map_array:array<map<string,int>>,\n nested_struct:struct<\n a:int,\n b:array<int>,\n c:struct<\n d:array<array<struct<\n e:int,\n f:string\n >>>\n >,\n g:map<string,struct<\n h:struct<\n i:array<double>\n >\n >>\n >\n>','Inferred from ORC file.'
---- TYPES
STRING, STRING, STRING
====