Files
impala/testdata/workloads/functional-query/queries/QueryTest/acid-nonacid-insert.test
Zoltan Borok-Nagy 6360657cb4 IMPALA-8636: Implement INSERT for insert-only ACID tables
This commit adds INSERT support for insert-only ACID tables.

The Frontend opens a transaction for INSERT statements when the target
table is transactional. It also allocates a write ID for the target
table. The Frontend aborts the transaction if an error occurs during
analysis/planning.

The Backend gets the transaction id and the write id in TFinalizeParams.
The write id is also set the for the HDFS table sinks. The sinks write
the files at their final destination which is an ACID base or delta
directory. There is no need for finalization of transactional INSERTS.

When the sinks finished with writing the data, the Coordinator invokes
updateCatalog() on catalogd which also commits the transaction if
everything went well, otherwise the Coordinator aborts the transaction.

Testing:
* added new tables during dataload
* added acid-insert.test file with INSERT statements against the new
  tables
* test insertions between ACID and non-ACID tables
* test error scenarios via debug actions
* added integration test with Hive to test_hms_integration.py. The test
  inserts data with Impala and reads with Hive. (These integration
  tests only run with exhaustive exploration strategy)

TODO in following commits:
* add locks and heartbeats (without heartbeats long-running transactions
  might be aborted by HMS)
* implement TRUNCATE
* CTAS creates files in the 'root' directory of the table/partition. It
  is handled correctly during SELECT, but would be better to create a
  base directory from the beginning. Hive creates a delta directory
  for CTAS.

Change-Id: Id6c36fa6902676f06b4e38730f737becfc7c06ad
Reviewed-on: http://gerrit.cloudera.org:8080/13559
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2019-07-27 13:45:51 +00:00

70 lines
1.2 KiB
Plaintext

====
---- QUERY
create table insertonly_acid (i int)
tblproperties('transactional'='true', 'transactional_properties'='insert_only');
insert into insertonly_acid values (1), (2);
create table plain (i int);
====
---- QUERY
# INSERT from ACID to PLAIN
insert into plain select * from insertonly_acid;
select * from plain;
---- RESULTS
1
2
---- TYPES
INT
====
---- QUERY
# INSERT from PLAIN to ACID
insert into insertonly_acid select cast(i + 2 as int) from plain;
select * from insertonly_acid;
---- RESULTS
1
2
3
4
---- TYPES
INT
====
---- QUERY
# CTAS PLAIN from ACID
create table plain_ctas as select * from insertonly_acid;
select * from plain_ctas;
---- RESULTS
1
2
3
4
---- TYPES
INT
====
---- QUERY
# CTAS ACID from PLAIN
create table insertonly_acid_ctas
tblproperties('transactional'='true', 'transactional_properties'='insert_only')
as select * from plain_ctas;
select * from insertonly_acid_ctas;
---- RESULTS
1
2
3
4
---- TYPES
INT
====
---- QUERY
# CTAS ACID from ACID
create table insertonly_acid_ctas_2
tblproperties('transactional'='true', 'transactional_properties'='insert_only')
as select * from insertonly_acid;
select * from insertonly_acid_ctas_2;
---- RESULTS
1
2
3
4
---- TYPES
INT
====