pvary commented on issue #3783:
URL: https://github.com/apache/iceberg/issues/3783#issuecomment-1006352825
@nssalian: With Hive 2.x and 3.x you can chose from the following
possibilities:
- For identity partitions:
```
CREATE TABLE database_a.table_a (
id bigint, name string
) PARTITIONED BY (
dept string
) STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler';
```
- For other partitioning schemas one can use the json formatted schema and
partition specification - this is very hard to use, and we do not really
recommend it:
```
CREATE EXTERNAL TABLE customers STORED BY
'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'
LOCATION '.../default/customers'
TBLPROPERTIES (
'iceberg.mr.table.schema'='{"type":"struct","schema-id":0,"fields":[{"id":1,"name":"customer_id","required":false,"type":"long"},{"id":2,"name":"first_name","required":false,"type":"string","doc":"This
is first
name"},{"id":3,"name":"last_name","required":false,"type":"string","doc":"This
is last name"}]}',
'iceberg.mr.table.partition.spec'='{"spec-id":0,"fields":[]}')
```
In Hive master @lcspinter created a PR which changes the Hive syntax and one
can create tables with Iceberg partitioning schemas
(https://issues.apache.org/jira/browse/HIVE-25179):
```
CREATE TABLE ... PARTITIONED BY SPEC( year(year_field), month(month_field),
day(day_field), hour(hour_field), truncate(3, truncate_field), bucket(5,
bucket_field bucket), identity_field ) STORED BY ICEBERG;
```
I hope this helps.
Thanks,
Peter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]