|
116 | 116 | %nonterm export_csv_config transactions.ExportCSVConfig |
117 | 117 | %nonterm export_csv_path String |
118 | 118 | %nonterm export_csv_source transactions.ExportCSVSource |
| 119 | +%nonterm export_iceberg_catalog_properties transactions.IcebergCatalogProperties |
| 120 | +%nonterm export_iceberg_config transactions.ExportIcebergConfig |
119 | 121 | %nonterm false logic.Disjunction |
120 | 122 | %nonterm ffi logic.FFI |
121 | 123 | %nonterm ffi_args Sequence[logic.Abstraction] |
|
199 | 201 | %validator_ignore_completeness BeTreeLocator |
200 | 202 | %validator_ignore_completeness BeTreeConfig |
201 | 203 | %validator_ignore_completeness ExportCSVColumns |
| 204 | +%validator_ignore_completeness IcebergCatalogProperties |
202 | 205 |
|
203 | 206 | %% |
204 | 207 |
|
@@ -1202,7 +1205,12 @@ abort |
1202 | 1205 | export |
1203 | 1206 | : "(" "export" export_csv_config ")" |
1204 | 1207 | construct: $$ = transactions.Export(csv_config=$3) |
1205 | | - deconstruct: $3: transactions.ExportCSVConfig = $$.csv_config |
| 1208 | + deconstruct if builtin.has_proto_field($$, 'csv_config'): |
| 1209 | + $3: transactions.ExportCSVConfig = $$.csv_config |
| 1210 | + | "(" "export_iceberg" export_iceberg_config ")" |
| 1211 | + construct: $$ = transactions.Export(iceberg_config=$3) |
| 1212 | + deconstruct if builtin.has_proto_field($$, 'iceberg_config'): |
| 1213 | + $3: transactions.ExportIcebergConfig = $$.iceberg_config |
1206 | 1214 |
|
1207 | 1215 | export_csv_config |
1208 | 1216 | : "(" "export_csv_config_v2" export_csv_path export_csv_source csv_config ")" |
@@ -1241,6 +1249,24 @@ export_csv_source |
1241 | 1249 | deconstruct if builtin.has_proto_field($$, 'table_def'): |
1242 | 1250 | $3: logic.RelationId = $$.table_def |
1243 | 1251 |
|
| 1252 | +export_iceberg_config |
| 1253 | + : "(" "export_iceberg_config" "(" "catalog_uri" STRING ")" "(" "namespace" STRING* ")" "(" "table_name" STRING ")" export_iceberg_catalog_properties "(" "schema" STRING ")" config_dict? ")" |
| 1254 | + construct: $$ = construct_export_iceberg_config_from_optional($5, $9, $13, $15, $18, $20) |
| 1255 | + deconstruct: |
| 1256 | + $5: String = $$.catalog_uri |
| 1257 | + $9: Sequence[String] = $$.namespace |
| 1258 | + $13: String = $$.table_name |
| 1259 | + $15: transactions.IcebergCatalogProperties = $$.catalog_properties |
| 1260 | + $18: String = $$.schema |
| 1261 | + $20: Optional[Sequence[Tuple[String, logic.Value]]] = deconstruct_export_iceberg_config_optional($$) |
| 1262 | + |
| 1263 | +export_iceberg_catalog_properties |
| 1264 | + : "(" "catalog_properties" "(" "warehouse" STRING ")" config_dict? ")" |
| 1265 | + construct: $$ = construct_iceberg_catalog_properties_from_optional($5, $7) |
| 1266 | + deconstruct: |
| 1267 | + $5: String = $$.warehouse |
| 1268 | + $7: Optional[Sequence[Tuple[String, logic.Value]]] = deconstruct_iceberg_catalog_properties_optional($$) |
| 1269 | + |
1244 | 1270 |
|
1245 | 1271 | %% |
1246 | 1272 |
|
@@ -1558,6 +1584,79 @@ def deconstruct_export_csv_config(msg: transactions.ExportCSVConfig) -> List[Tup |
1558 | 1584 | return builtin.list_sort(result) |
1559 | 1585 |
|
1560 | 1586 |
|
| 1587 | +def construct_export_iceberg_config_from_optional( |
| 1588 | + catalog_uri: String, |
| 1589 | + namespace: Sequence[String], |
| 1590 | + table_name: String, |
| 1591 | + catalog_properties: transactions.IcebergCatalogProperties, |
| 1592 | + schema: String, |
| 1593 | + config_dict: Optional[Sequence[Tuple[String, logic.Value]]], |
| 1594 | +) -> transactions.ExportIcebergConfig: |
| 1595 | + prefix: String = "" |
| 1596 | + target_file_size_bytes: int = _extract_value_int64(None, 0) |
| 1597 | + compression: String = "" |
| 1598 | + if config_dict is not None: |
| 1599 | + config: Dict[String, logic.Value] = builtin.dict_from_list(builtin.unwrap_option(config_dict)) |
| 1600 | + prefix = _extract_value_string(builtin.dict_get(config, "prefix"), "") |
| 1601 | + target_file_size_bytes = _extract_value_int64(builtin.dict_get(config, "target_file_size_bytes"), 0) |
| 1602 | + compression = _extract_value_string(builtin.dict_get(config, "compression"), "") |
| 1603 | + return transactions.ExportIcebergConfig( |
| 1604 | + catalog_uri=catalog_uri, |
| 1605 | + namespace=namespace, |
| 1606 | + table_name=table_name, |
| 1607 | + catalog_properties=catalog_properties, |
| 1608 | + schema=schema, |
| 1609 | + prefix=builtin.some(prefix), |
| 1610 | + target_file_size_bytes=builtin.some(target_file_size_bytes), |
| 1611 | + compression=compression, |
| 1612 | + ) |
| 1613 | + |
| 1614 | + |
| 1615 | +def deconstruct_export_iceberg_config_optional( |
| 1616 | + msg: transactions.ExportIcebergConfig, |
| 1617 | +) -> Optional[Sequence[Tuple[String, logic.Value]]]: |
| 1618 | + result: List[Tuple[String, logic.Value]] = list[Tuple[String, logic.Value]]() |
| 1619 | + if builtin.unwrap_option(msg.prefix) != "": |
| 1620 | + builtin.list_push(result, builtin.tuple("prefix", _make_value_string(builtin.unwrap_option(msg.prefix)))) |
| 1621 | + if builtin.unwrap_option(msg.target_file_size_bytes) != 0: |
| 1622 | + builtin.list_push(result, builtin.tuple("target_file_size_bytes", _make_value_int64(builtin.unwrap_option(msg.target_file_size_bytes)))) |
| 1623 | + if msg.compression != "": |
| 1624 | + builtin.list_push(result, builtin.tuple("compression", _make_value_string(msg.compression))) |
| 1625 | + if builtin.length(result) == 0: |
| 1626 | + return None |
| 1627 | + return builtin.some(builtin.list_sort(result)) |
| 1628 | + |
| 1629 | + |
| 1630 | +def construct_iceberg_catalog_properties_from_optional( |
| 1631 | + warehouse: String, |
| 1632 | + config_dict: Optional[Sequence[Tuple[String, logic.Value]]], |
| 1633 | +) -> transactions.IcebergCatalogProperties: |
| 1634 | + token: String = "" |
| 1635 | + credential: String = "" |
| 1636 | + if config_dict is not None: |
| 1637 | + config: Dict[String, logic.Value] = builtin.dict_from_list(builtin.unwrap_option(config_dict)) |
| 1638 | + token = _extract_value_string(builtin.dict_get(config, "token"), "") |
| 1639 | + credential = _extract_value_string(builtin.dict_get(config, "credential"), "") |
| 1640 | + return transactions.IcebergCatalogProperties( |
| 1641 | + warehouse=warehouse, |
| 1642 | + token=builtin.some(token), |
| 1643 | + credential=builtin.some(credential), |
| 1644 | + ) |
| 1645 | + |
| 1646 | + |
| 1647 | +def deconstruct_iceberg_catalog_properties_optional( |
| 1648 | + msg: transactions.IcebergCatalogProperties, |
| 1649 | +) -> Optional[Sequence[Tuple[String, logic.Value]]]: |
| 1650 | + result: List[Tuple[String, logic.Value]] = list[Tuple[String, logic.Value]]() |
| 1651 | + if builtin.unwrap_option(msg.token) != "": |
| 1652 | + builtin.list_push(result, builtin.tuple("token", _make_value_string(builtin.unwrap_option(msg.token)))) |
| 1653 | + if builtin.unwrap_option(msg.credential) != "": |
| 1654 | + builtin.list_push(result, builtin.tuple("credential", _make_value_string(builtin.unwrap_option(msg.credential)))) |
| 1655 | + if builtin.length(result) == 0: |
| 1656 | + return None |
| 1657 | + return builtin.some(builtin.list_sort(result)) |
| 1658 | + |
| 1659 | + |
1561 | 1660 | def deconstruct_relation_id_string(msg: logic.RelationId) -> String: |
1562 | 1661 | name: Optional[String] = builtin.relation_id_to_string(msg) |
1563 | 1662 | return builtin.unwrap_option(name) |
|
0 commit comments