Files
impala/testdata/workloads/functional-query/queries/QueryTest/load.test
Tim Armstrong bc8c55afcd IMPALA-3729: batch_size=1 coverage for avro scanner
Also fix a stale comment in the avro scanner header.

The main work here is to fix the handling of empty result sets in the
test result verifier. This is a problem because we wanted to verify
that the results in the test file were a superset of the rows
returned, and this was thrown off by superflous '' rows in the expected
and actual result sets.

The basic problem is that the way test file sections
was parsed conflated an empty result section with non-empty result
section that had a single empty string. I.e.:

---- RESULTS
====

vs
---- RESULTS

====

both got resolved to [''].

Change-Id: Ia007e558d92c7e4ce30be90446fdbb1f50a0ebc4
Reviewed-on: http://gerrit.cloudera.org:8080/3413
Tested-by: Internal Jenkins
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
2016-07-19 23:30:02 -07:00

195 lines
4.8 KiB
Plaintext

====
---- QUERY
alter table functional.test_load add partition
(year=2009, month=1)
---- RESULTS
====
---- QUERY
alter table functional.test_load add partition
(year=2010, month=1)
---- RESULTS
====
---- 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
select count(*) from functional.test_load where year=2010 and month=1
---- SETUP
# A refresh needs to happen before selecting from this table because file(s) changed
# underneath it.
RESET functional.test_load
---- 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
====