Files
impala/testdata/workloads/functional-query/queries/QueryTest/load.test
Zoltan Borok-Nagy eb8b118db5 IMPALA-10384: Make partition names consistent between BE and FE
In the BE we build partition names with the trailing char '/'. In the FE
we build partition names without a trailing char. We should make this
consistent because this causes some annoying string adjustments in
the FE and can cause hidden bugs.

This patch creates partition names without the trailing '/' both in
the BE and the FE. This follows Hive's behavior that also prints
partition names without the trailing '/'.

Testing:
 * Ran exhaustive tests

Change-Id: I7e40111e2d1148aeb01ebc985bbb15db7d6a6012
Reviewed-on: http://gerrit.cloudera.org:8080/16850
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-12-11 19:51:28 +00:00

194 lines
4.8 KiB
Plaintext

====
---- QUERY
alter table functional.test_load add partition
(year=2009, month=1)
---- RESULTS
'New partition has been added to the table.'
====
---- QUERY
alter table functional.test_load add partition
(year=2010, month=1)
---- RESULTS
'New partition has been added to the table.'
====
---- QUERY
# Insert some data into one of the partitions, used to verify we are not clobbering
# existing data when loading into a partition.
insert overwrite table functional.test_load partition (year=2009, month=1)
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.alltypes where year = 2009 and month = 1
---- RESULTS
year=2009/month=1: 310
====
---- QUERY
select count(*) from functional.test_load
---- RESULTS
310
====
---- QUERY
# No data should be in the "year=2010" partition.
select count(*) from functional.test_load where year=2010
---- RESULTS
0
====
---- QUERY
# Load a specific data file.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_staging/1/100101.txt'
into table functional.test_load partition(year=2010, month=1)
---- RESULTS
'Loaded 1 file(s). Total files in destination location: 1'
---- TYPES
STRING
====
---- QUERY
select count(*) from functional.test_load where year=2010 and month=1
---- RESULTS
310
---- TYPES
BIGINT
====
---- QUERY
# Load another data file with the same name (overwrite not specified)
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_staging/2/100101.txt'
into table functional.test_load partition(year=2010, month=1)
---- RESULTS
'Loaded 1 file(s). Total files in destination location: 2'
---- TYPES
STRING
====
---- QUERY
select count(*) from functional.test_load where year=2010 and month=1
---- RESULTS
620
---- TYPES
BIGINT
====
---- QUERY
# Load the file one more time, this time with overwrite.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_staging/3/100101.txt'
overwrite into table functional.test_load partition(year=2010, month=1)
---- RESULTS
'Loaded 1 file(s). Total files in destination location: 1'
---- TYPES
STRING
====
---- QUERY
select count(*) from functional.test_load where year=2010 and month=1
---- RESULTS
310
---- TYPES
BIGINT
====
---- QUERY
# The other partition still has the same data.
select count(*) from functional.test_load where year=2009
---- RESULTS
310
---- TYPES
BIGINT
====
---- QUERY
# Table should be empty.
select count(*) from functional.test_load_nopart
---- RESULTS
0
---- TYPES
BIGINT
====
---- QUERY
# Load a directory of file(s) into the table.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_staging/4/'
overwrite into table functional.test_load_nopart
---- RESULTS
'Loaded 4 file(s). Total files in destination location: 4'
---- TYPES
STRING
====
---- QUERY
# Table has some data.
select count(*) from functional.test_load_nopart
---- RESULTS
1000
---- TYPES
BIGINT
====
---- QUERY
# Load more file(s) into the table without overwrite.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_staging/5/'
into table functional.test_load_nopart
---- RESULTS
'Loaded 4 file(s). Total files in destination location: 8'
---- TYPES
STRING
====
---- QUERY
# Double the data.
select count(*) from functional.test_load_nopart
---- RESULTS
2000
---- TYPES
BIGINT
====
---- QUERY
# Load a file from the partitioned table.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load/year=2010/month=1/100101.txt'
into table functional.test_load_nopart
---- RESULTS
'Loaded 1 file(s). Total files in destination location: 9'
---- TYPES
STRING
====
---- QUERY
# The change is reflected in both tables:
select count(*) from functional.test_load_nopart
---- RESULTS
2310
---- TYPES
BIGINT
====
---- QUERY
truncate functional.test_load;
select count(*) from functional.test_load where year=2010 and month=1
---- RESULTS
0
---- TYPES
BIGINT
====
---- QUERY
# Have the table load itself (with overwrite). Since the file(s) were moved from the dest
# location there are actually no file(s) to overwrite.
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_nopart/'
overwrite into table functional.test_load_nopart
---- RESULTS
'Loaded 9 file(s). Total files in destination location: 9'
---- TYPES
STRING
====
---- QUERY
# The table should have the same data
select count(*) from functional.test_load_nopart
---- RESULTS
2310
---- TYPES
BIGINT
====
---- QUERY
# Have the table load itself (without overwrite)
load data inpath '$FILESYSTEM_PREFIX/test-warehouse/test_load_nopart/'
into table functional.test_load_nopart
---- RESULTS
'Loaded 9 file(s). Total files in destination location: 9'
---- TYPES
STRING
====
---- QUERY
# The table should still have the same data since load operations move file(s) rather than
# copying file(s).
select count(*) from functional.test_load_nopart
---- RESULTS
2310
---- TYPES
BIGINT
====