Skip to content

Commit e78edfc

Browse files
committed
update proto to make it possible to pass table_def vs gnf_def. Distinction is needed because GNF contain key that is not part of the exported iceberg
1 parent 39c9be5 commit e78edfc

2 files changed

Lines changed: 30 additions & 17 deletions

File tree

proto/relationalai/lqp/v1/transactions.proto

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,25 @@ message ExportCSVSource {
121121
message ExportIcebergConfig {
122122
IcebergLocator locator = 1;
123123
IcebergCatalogConfig config = 2;
124-
repeated ExportIcebergColumn columns = 3;
124+
ExportIcebergColumns columns = 3;
125125
optional string prefix = 4; // Default: "data"
126126
optional int64 target_file_size_bytes = 5; // Default: 512 MB
127127
string compression = 6; // UNCOMPRESSED, SNAPPY, GZIP, LZ4, ZSTD
128-
map<string, string> create_table_properties = 7; // properties for table creation
128+
map<string, string> table_properties = 7; // properties for table creation
129129
}
130130

131131
message ExportIcebergColumn {
132132
string name = 1;
133-
RelationId column_data = 2;
134-
Type type = 3;
135-
bool nullable = 4;
133+
Type type = 2;
134+
bool nullable = 3;
135+
}
136+
137+
message ExportIcebergColumns {
138+
oneof iceberg_columns {
139+
repeated RelationId source_gnf_defs = 1;
140+
RelationId source_table_def = 2;
141+
}
142+
repeated ExportIcebergColumn target_columns = 3;
136143
}
137144

138145
//

tests/lqp/iceberg_export.lqp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(and (= id 1) (= region "us-east") (= amount 100.0))
1010
(and (= id 2) (= region "eu-west") (= amount 250.5))))))))
1111
(reads
12-
;; Minimal export
12+
;; Minimal export with gnf defs as column source
1313
(export_iceberg
1414
(export_iceberg_config
1515
(iceberg_locator
@@ -21,12 +21,14 @@
2121
(properties)
2222
(auth_properties))
2323
(columns
24-
(iceberg_column "id" :id INT false)
25-
(iceberg_column "region" :region STRING false)
26-
(iceberg_column "amount" :amount FLOAT false))
27-
(create_table_properties)))
24+
(source_gnf_defs :id :region :amount)
25+
(target_columns
26+
(iceberg_column "id" INT false)
27+
(iceberg_column "region" STRING false)
28+
(iceberg_column "amount" FLOAT false)))
29+
(table_properties)))
2830

29-
;; Full export with scope, property maps, and trailing export options
31+
;; Full export with scope, property maps, table source, and trailing export options
3032
(export_iceberg
3133
(export_iceberg_config
3234
(iceberg_locator
@@ -41,10 +43,12 @@
4143
(prop "credential" "my-credential")
4244
(prop "token" "secret-token-123")))
4345
(columns
44-
(iceberg_column "id" :id INT false)
45-
(iceberg_column "region" :region STRING false)
46-
(iceberg_column "amount" :amount FLOAT false))
47-
(create_table_properties (prop "write.format.default" "parquet"))
46+
(source_table_def :sales)
47+
(target_columns
48+
(iceberg_column "id" INT false)
49+
(iceberg_column "region" STRING false)
50+
(iceberg_column "amount" FLOAT false)))
51+
(table_properties (prop "write.format.default" "parquet"))
4852
{:prefix "part" :target_file_size_bytes 268435456 :compression "SNAPPY"}))
4953

5054
;; Empty namespace on the locator
@@ -59,5 +63,7 @@
5963
(properties)
6064
(auth_properties))
6165
(columns
62-
(iceberg_column "id" :id INT false))
63-
(create_table_properties))))))
66+
(source_gnf_defs :id)
67+
(target_columns
68+
(iceberg_column "id" INT false)))
69+
(table_properties))))))

0 commit comments

Comments
 (0)