trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.49k stars 3.02k forks source link

Adding timestamp_ntz column should add reader and writer features #24158

Open ebyhr opened 3 days ago

ebyhr commented 3 days ago

Trino:

CREATE TABLE test (a int) WITH (change_data_feed_enabled = true);
TABLE "test$properties";
             key             | value
-----------------------------+-------
 delta.enableChangeDataFeed  | true
 delta.enableDeletionVectors | false
 delta.minReaderVersion      | 1
 delta.minWriterVersion      | 4
(4 rows)

-- This ADD COLUMN should add delta.feature.changeDataFeed = supported
ALTER TABLE test ADD COLUMN b timestamp;
TABLE "test$properties";
             key             |   value
-----------------------------+-----------
 delta.enableDeletionVectors | false
 delta.enableChangeDataFeed  | true
 delta.minReaderVersion      | 3
 delta.minWriterVersion      | 7
 delta.feature.timestampNtz  | supported

Spark:

CREATE TABLE test (a int) USING delta TBLPROPERTIES (delta.enableChangeDataFeed = true) LOCATION 's3://test-bucket/test';
SHOW TBLPROPERTIES test;
delta.enableChangeDataFeed  true
delta.minReaderVersion  1
delta.minWriterVersion  4

-- SET TBLPROPERTIES is required before adding timestamp_ntz column
ALTER TABLE test SET TBLPROPERTIES ('delta.feature.timestampNtz' = 'supported');
ALTER TABLE test ADD COLUMN b timestamp_ntz;
delta.enableChangeDataFeed  true
delta.feature.appendOnly    supported
delta.feature.changeDataFeed    supported
delta.feature.checkConstraints  supported
delta.feature.generatedColumns  supported
delta.feature.invariants    supported
delta.feature.timestampNtz  supported
delta.minReaderVersion  3
delta.minWriterVersion  7