|
83 | 83 | %nonterm csv_locator_paths Sequence[String] |
84 | 84 | %nonterm csvlocator logic.CSVLocator |
85 | 85 | %nonterm data logic.Data |
| 86 | +%nonterm iceberg_config logic.IcebergConfig |
| 87 | +%nonterm iceberg_config_credentials Sequence[Tuple[String, String]] |
| 88 | +%nonterm iceberg_config_properties Sequence[Tuple[String, String]] |
| 89 | +%nonterm iceberg_config_scope String |
| 90 | +%nonterm iceberg_data logic.IcebergData |
| 91 | +%nonterm iceberg_kv_pair Tuple[String, String] |
| 92 | +%nonterm iceberg_locator logic.IcebergLocator |
| 93 | +%nonterm iceberg_locator_namespace Sequence[String] |
| 94 | +%nonterm iceberg_to_snapshot String |
86 | 95 | %nonterm date logic.DateValue |
87 | 96 | %nonterm date_type logic.DateType |
88 | 97 | %nonterm datetime logic.DateTimeValue |
@@ -957,6 +966,10 @@ data |
957 | 966 | construct: $$ = logic.Data(csv_data=$1) |
958 | 967 | deconstruct if builtin.has_proto_field($$, 'csv_data'): |
959 | 968 | $1: logic.CSVData = $$.csv_data |
| 969 | + | iceberg_data |
| 970 | + construct: $$ = logic.Data(iceberg_data=$1) |
| 971 | + deconstruct if builtin.has_proto_field($$, 'iceberg_data'): |
| 972 | + $1: logic.IcebergData = $$.iceberg_data |
960 | 973 |
|
961 | 974 | edb_path |
962 | 975 | : "[" STRING* "]" |
@@ -1026,6 +1039,54 @@ csv_config |
1026 | 1039 | construct: $$ = construct_csv_config($3) |
1027 | 1040 | deconstruct: $3: Sequence[Tuple[String, logic.Value]] = deconstruct_csv_config($$) |
1028 | 1041 |
|
| 1042 | +iceberg_data |
| 1043 | + : "(" "iceberg_data" iceberg_locator iceberg_config gnf_columns iceberg_to_snapshot? ")" |
| 1044 | + construct: $$ = logic.IcebergData(locator=$3, config=$4, columns=$5, to_snapshot=$6) |
| 1045 | + deconstruct: |
| 1046 | + $3: logic.IcebergLocator = $$.locator |
| 1047 | + $4: logic.IcebergConfig = $$.config |
| 1048 | + $5: Sequence[logic.GNFColumn] = $$.columns |
| 1049 | + $6: Optional[String] = $$.to_snapshot |
| 1050 | + |
| 1051 | +iceberg_locator_namespace |
| 1052 | + : "(" "namespace" STRING* ")" |
| 1053 | + |
| 1054 | +iceberg_locator |
| 1055 | + : "(" "iceberg_locator" STRING iceberg_locator_namespace STRING ")" |
| 1056 | + construct: $$ = logic.IcebergLocator(table_name=$3, namespace=$4, warehouse=$5) |
| 1057 | + deconstruct: |
| 1058 | + $3: String = $$.table_name |
| 1059 | + $4: Sequence[String] = $$.namespace |
| 1060 | + $5: String = $$.warehouse |
| 1061 | + |
| 1062 | +iceberg_config |
| 1063 | + : "(" "iceberg_config" STRING iceberg_config_scope? iceberg_config_properties? iceberg_config_credentials? ")" |
| 1064 | + construct: $$ = construct_iceberg_config($3, $4, $5, $6) |
| 1065 | + deconstruct: |
| 1066 | + $3: String = $$.catalog_uri |
| 1067 | + $4: Optional[String] = $$.scope if $$.scope != "" else None |
| 1068 | + $5: Optional[Sequence[Tuple[String, String]]] = builtin.dict_to_pairs($$.properties) if not builtin.is_empty(builtin.dict_to_pairs($$.properties)) else None |
| 1069 | + $6: Optional[Sequence[Tuple[String, String]]] = builtin.dict_to_pairs($$.credentials) if not builtin.is_empty(builtin.dict_to_pairs($$.credentials)) else None |
| 1070 | + |
| 1071 | +iceberg_config_scope |
| 1072 | + : "(" "scope" STRING ")" |
| 1073 | + |
| 1074 | +iceberg_config_properties |
| 1075 | + : "(" "properties" iceberg_kv_pair* ")" |
| 1076 | + |
| 1077 | +iceberg_config_credentials |
| 1078 | + : "(" "credentials" iceberg_kv_pair* ")" |
| 1079 | + |
| 1080 | +iceberg_kv_pair |
| 1081 | + : "(" STRING STRING ")" |
| 1082 | + construct: $$ = builtin.tuple($2, $3) |
| 1083 | + deconstruct: |
| 1084 | + $2: String = $$[0] |
| 1085 | + $3: String = $$[1] |
| 1086 | + |
| 1087 | +iceberg_to_snapshot |
| 1088 | + : "(" "to_snapshot" STRING ")" |
| 1089 | + |
1029 | 1090 | gnf_column_path |
1030 | 1091 | : STRING |
1031 | 1092 | construct: $$ = [$1] |
@@ -1439,6 +1500,23 @@ def deconstruct_csv_config(msg: logic.CSVConfig) -> List[Tuple[String, logic.Val |
1439 | 1500 | return builtin.list_sort(result) |
1440 | 1501 |
|
1441 | 1502 |
|
| 1503 | +def construct_iceberg_config( |
| 1504 | + catalog_uri: String, |
| 1505 | + scope: Optional[String], |
| 1506 | + properties: Optional[Sequence[Tuple[String, String]]], |
| 1507 | + credentials: Optional[Sequence[Tuple[String, String]]], |
| 1508 | +) -> logic.IcebergConfig: |
| 1509 | + props: Dict[String, String] = builtin.dict_from_list(builtin.unwrap_option_or(properties, list[Tuple[String, String]]())) |
| 1510 | + creds: Dict[String, String] = builtin.dict_from_list(builtin.unwrap_option_or(credentials, list[Tuple[String, String]]())) |
| 1511 | + return logic.IcebergConfig( |
| 1512 | + catalog_uri=catalog_uri, |
| 1513 | + scope=builtin.unwrap_option_or(scope, ""), |
| 1514 | + properties=props, |
| 1515 | + credentials=creds, |
| 1516 | + ) |
| 1517 | + |
| 1518 | + |
| 1519 | + |
1442 | 1520 |
|
1443 | 1521 | def deconstruct_betree_info_config(msg: logic.BeTreeInfo) -> List[Tuple[String, logic.Value]]: |
1444 | 1522 | result: List[Tuple[String, logic.Value]] = list[Tuple[String, logic.Value]]() |
|
0 commit comments