Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class TestDeltaLakeBasic
new ResourceTable("person_without_old_jsons", "databricks73/person_without_old_jsons"),
new ResourceTable("person_without_checkpoints", "databricks73/person_without_checkpoints"));
private static final List<ResourceTable> OTHER_TABLES = ImmutableList.of(
new ResourceTable("allow_column_defaults", "deltalake/allow_column_defaults"),
new ResourceTable("stats_with_minmax_nulls", "deltalake/stats_with_minmax_nulls"),
new ResourceTable("no_column_stats", "databricks73/no_column_stats"),
new ResourceTable("deletion_vectors", "databricks122/deletion_vectors"),
Expand Down Expand Up @@ -935,6 +936,20 @@ public void testIdentityColumns()
entry("delta.identity.allowExplicitInsert", false));
}

/**
* @see deltalake.allow_column_defaults
*/
@Test
public void testAllowColumnDefaults()
{
assertQuery("SELECT * FROM allow_column_defaults", "VALUES (1, 16)");

// TODO (https://github.com/trinodb/trino/issues/22413) Add support for allowColumnDefaults writer feature
assertQueryFails("INSERT INTO allow_column_defaults VALUES (2, 32)", "\\QUnsupported writer features: [allowColumnDefaults]");
assertQueryFails("INSERT INTO allow_column_defaults (a) VALUES (2)", "\\QUnsupported writer features: [allowColumnDefaults]");
}


/**
* @see databricks122.deletion_vectors
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Data generated using OSS Delta Lake 3.2.0:

```sql
CREATE TABLE test_allow_column_defaults
(a int, b int default 16)
USING delta
LOCATION ?
TBLPROPERTIES (
'delta.feature.allowColumnDefaults' = 'enabled'
);

INSERT INTO test_allow_column_defaults (a) VALUES (1);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"commitInfo":{"timestamp":1718700387338,"operation":"CREATE TABLE","operationParameters":{"partitionBy":"[]","clusterBy":"[]","description":null,"isManaged":"false","properties":"{}"},"isolationLevel":"Serializable","isBlindAppend":true,"operationMetrics":{},"engineInfo":"Apache-Spark/3.5.0 Delta-Lake/3.2.0","txnId":"3ecfcfcd-5008-4b4a-9797-c0b333987ac4"}}
{"metaData":{"id":"3d5205bb-8b49-4834-b690-97e021b1ab12","format":{"provider":"parquet","options":{}},"schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"a\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"b\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{\"EXISTS_DEFAULT\":\"16\",\"CURRENT_DEFAULT\":\"16\"}}]}","partitionColumns":[],"configuration":{},"createdTime":1718700387186}}
{"protocol":{"minReaderVersion":1,"minWriterVersion":7,"writerFeatures":["allowColumnDefaults"]}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"commitInfo":{"timestamp":1718700578147,"operation":"WRITE","operationParameters":{"mode":"Append","partitionBy":"[]"},"readVersion":0,"isolationLevel":"Serializable","isBlindAppend":true,"operationMetrics":{"numFiles":"1","numOutputRows":"1","numOutputBytes":"666"},"engineInfo":"Apache-Spark/3.5.0 Delta-Lake/3.2.0","txnId":"b9c518df-f05b-402c-b10a-ab20dfe02857"}}
{"add":{"path":"part-00000-42b7bd7e-34ab-4981-b4ae-51f9b3421a9f-c000.snappy.parquet","partitionValues":{},"size":666,"modificationTime":1718700578000,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"a\":1,\"b\":16},\"maxValues\":{\"a\":1,\"b\":16},\"nullCount\":{\"a\":0,\"b\":0}}"}}
Binary file not shown.