mirror of
https://github.com/apache/impala.git
synced 2026-02-03 09:00:39 -05:00
This patch mainly realizes the querying of iceberg table through impala,
we can use the following sql to create an external iceberg table:
CREATE EXTERNAL TABLE default.iceberg_test (
level string,
event_time timestamp,
message string,
)
STORED AS ICEBERG
LOCATION 'hdfs://xxx'
TBLPROPERTIES ('iceberg_file_format'='parquet');
Or just including table name and location like this:
CREATE EXTERNAL TABLE default.iceberg_test
STORED AS ICEBERG
LOCATION 'hdfs://xxx'
TBLPROPERTIES ('iceberg_file_format'='parquet');
'iceberg_file_format' is the file format in iceberg, currently only
support PARQUET, other format would be supported in the future. And
if you don't specify this property in your SQL, default file format
is PARQUET.
We achieved this function by treating the iceberg table as normal
unpartitioned hdfs table. When querying iceberg table, we pushdown
partition column predicates to iceberg to decide which data files
need to be scanned, and then transfer this information to BE to
do the real scan operation.
Testing:
- Unit test for Iceberg in FileMetadataLoaderTest
- Create table tests in functional_schema_template.sql
- Iceberg table query test in test_scanners.py
Change-Id: I856cfee4f3397d1a89cf17650e8d4fbfe1f2b006
Reviewed-on: http://gerrit.cloudera.org:8080/16143
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
====
|
|
---- QUERY
|
|
CREATE TABLE iceberg_test1
|
|
STORED AS ICEBERG;
|
|
---- CATCH
|
|
AnalysisException: Table requires at least 1 column for managed iceberg table.
|
|
====
|
|
---- QUERY
|
|
CREATE TABLE iceberg_test2(
|
|
level STRING
|
|
)
|
|
PARTITION BY SPEC
|
|
(
|
|
level IDENTITY,
|
|
event_time HOUR
|
|
)
|
|
STORED AS ICEBERG;
|
|
---- CATCH
|
|
AnalysisException: Cannot find source column: event_time
|
|
====
|
|
---- QUERY
|
|
CREATE TABLE iceberg_test3(
|
|
level STRING
|
|
)
|
|
STORED AS ICEBERG;
|
|
INSERT INTO iceberg_test3 values('1');
|
|
---- CATCH
|
|
AnalysisException: Impala does not support INSERTing into iceberg table: $DATABASE.iceberg_test3
|
|
====
|
|
---- QUERY
|
|
TRUNCATE iceberg_test3
|
|
---- CATCH
|
|
AnalysisException: TRUNCATE TABLE not supported on iceberg table: $DATABASE.iceberg_test3
|
|
====
|
|
---- QUERY
|
|
ALTER TABLE iceberg_test3 ADD COLUMN event_time TIMESTAMP
|
|
---- CATCH
|
|
AnalysisException: ALTER TABLE not allowed on iceberg table: iceberg_test3
|
|
====
|
|
---- QUERY
|
|
# iceberg_non_partitioned is not partitioned
|
|
SHOW PARTITIONS functional_parquet.iceberg_non_partitioned
|
|
---- CATCH
|
|
AnalysisException: Table is not partitioned: functional_parquet.iceberg_non_partitioned
|
|
====
|