Skip to content

Commit e0fd473

Browse files
committed
fix go test
1 parent 3d74d01 commit e0fd473

5 files changed

Lines changed: 14 additions & 34 deletions

File tree

meta/src/meta/grammar.y

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ iceberg_to_snapshot
11821182

11831183
iceberg_data
11841184
: "(" "iceberg_data" iceberg_locator iceberg_config gnf_columns iceberg_to_snapshot? ")"
1185-
construct: $$ = logic.IcebergData(locator=$3, config=$4, columns=$5, to_snapshot=builtin.unwrap_option_or($6, ""))
1185+
construct: $$ = logic.IcebergData(locator=$3, config=$4, columns=$5, to_snapshot=$6)
11861186
deconstruct:
11871187
$3: logic.IcebergLocator = $$.locator
11881188
$4: logic.IcebergConfig = $$.config
@@ -1643,10 +1643,9 @@ def construct_iceberg_config(
16431643
) -> logic.IcebergConfig:
16441644
props: Dict[String, String] = builtin.string_map_from_pairs(property_pairs)
16451645
auth_props: Dict[String, String] = builtin.string_map_from_pairs(auth_property_pairs)
1646-
scope_pb: String = builtin.unwrap_option_or(scope_opt, "")
16471646
return logic.IcebergConfig(
16481647
catalog_uri=catalog_uri,
1649-
scope=scope_pb,
1648+
scope=scope_opt,
16501649
properties=props,
16511650
auth_properties=auth_props,
16521651
)

meta/src/meta/grammar_validator.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@
6262
from .validation_result import ValidationResult
6363

6464

65-
def _optional_string_allows_plain_string(
66-
actual: TargetType, expected: TargetType
67-
) -> bool:
68-
"""True if actual is String and expected is Option[String] (optional proto string)."""
69-
if isinstance(expected, OptionType) and isinstance(expected.element_type, BaseType):
70-
if expected.element_type.name != "String":
71-
return False
72-
return isinstance(actual, BaseType) and actual.name == "String"
73-
return False
74-
75-
7665
class GrammarValidator:
7766
"""Validates grammar against protobuf specification."""
7867

@@ -282,17 +271,12 @@ def _check_new_message_types(self, new_msg: NewMessage, context: str) -> None:
282271

283272
# Check actual type is a subtype of expected type (actual_type <: expected_type)
284273
if actual_type is not None and not is_subtype(actual_type, expected_type):
285-
# Optional proto string fields are often represented as plain String at runtime
286-
# (e.g. ProtoBuf.jl uses "" for unset); allow String where Option[String] is expected.
287-
if _optional_string_allows_plain_string(actual_type, expected_type):
288-
pass
289-
else:
290-
self.result.add_error(
291-
"field_type",
292-
f"In {context}: NewMessage {new_msg.name} field '{field_name}' has type {actual_type}, expected {expected_type}",
293-
proto_type=new_msg.name,
294-
rule_name=context,
295-
)
274+
self.result.add_error(
275+
"field_type",
276+
f"In {context}: NewMessage {new_msg.name} field '{field_name}' has type {actual_type}, expected {expected_type}",
277+
proto_type=new_msg.name,
278+
rule_name=context,
279+
)
296280

297281
# Check for missing fields
298282
for field in proto_message.fields:

sdks/go/src/parser.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,7 @@ func (p *Parser) construct_export_csv_config_with_source(path string, csv_source
858858
func (p *Parser) construct_iceberg_config(catalog_uri string, scope_opt *string, property_pairs [][]interface{}, auth_property_pairs [][]interface{}) *pb.IcebergConfig {
859859
props := stringMapFromPairs(property_pairs)
860860
auth_props := stringMapFromPairs(auth_property_pairs)
861-
scope_pb := deref(scope_opt, "")
862-
_t2097 := &pb.IcebergConfig{CatalogUri: catalog_uri, Scope: scope_pb, Properties: props, AuthProperties: auth_props}
861+
_t2097 := &pb.IcebergConfig{CatalogUri: catalog_uri, Scope: scope_opt, Properties: props, AuthProperties: auth_props}
863862
return _t2097
864863
}
865864

@@ -4380,7 +4379,7 @@ func (p *Parser) parse_iceberg_data() *pb.IcebergData {
43804379
}
43814380
iceberg_to_snapshot1184 := _t1953
43824381
p.consumeLiteral(")")
4383-
_t1955 := &pb.IcebergData{Locator: iceberg_locator1181, Config: iceberg_config1182, Columns: gnf_columns1183, ToSnapshot: ptr(deref(iceberg_to_snapshot1184, ""))}
4382+
_t1955 := &pb.IcebergData{Locator: iceberg_locator1181, Config: iceberg_config1182, Columns: gnf_columns1183, ToSnapshot: iceberg_to_snapshot1184}
43844383
result1186 := _t1955
43854384
p.recordSpan(int(span_start1185), "IcebergData")
43864385
return result1186

sdks/julia/LogicalQueryProtocol.jl/src/parser.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,7 @@ end
567567
function construct_iceberg_config(parser::ParserState, catalog_uri::String, scope_opt::Union{Nothing, String}, property_pairs::Vector{Tuple{String, String}}, auth_property_pairs::Vector{Tuple{String, String}})::Proto.IcebergConfig
568568
props = Dict(property_pairs)
569569
auth_props = Dict(auth_property_pairs)
570-
scope_pb = (!isnothing(scope_opt) ? scope_opt : "")
571-
_t2086 = Proto.IcebergConfig(catalog_uri=catalog_uri, scope=scope_pb, properties=props, auth_properties=auth_props)
570+
_t2086 = Proto.IcebergConfig(catalog_uri=catalog_uri, scope=scope_opt, properties=props, auth_properties=auth_props)
572571
return _t2086
573572
end
574573

@@ -3712,7 +3711,7 @@ function parse_iceberg_data(parser::ParserState)::Proto.IcebergData
37123711
end
37133712
iceberg_to_snapshot1184 = _t1942
37143713
consume_literal!(parser, ")")
3715-
_t1944 = Proto.IcebergData(locator=iceberg_locator1181, config=iceberg_config1182, columns=gnf_columns1183, to_snapshot=(!isnothing(iceberg_to_snapshot1184) ? iceberg_to_snapshot1184 : ""))
3714+
_t1944 = Proto.IcebergData(locator=iceberg_locator1181, config=iceberg_config1182, columns=gnf_columns1183, to_snapshot=iceberg_to_snapshot1184)
37163715
result1186 = _t1944
37173716
record_span!(parser, span_start1185, "IcebergData")
37183717
return result1186

sdks/python/src/lqp/gen/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,7 @@ def construct_export_csv_config_with_source(self, path: str, csv_source: transac
646646
def construct_iceberg_config(self, catalog_uri: str, scope_opt: str | None, property_pairs: Sequence[tuple[str, str]], auth_property_pairs: Sequence[tuple[str, str]]) -> logic_pb2.IcebergConfig:
647647
props = dict(property_pairs)
648648
auth_props = dict(auth_property_pairs)
649-
scope_pb = (scope_opt if scope_opt is not None else "")
650-
_t2095 = logic_pb2.IcebergConfig(catalog_uri=catalog_uri, scope=scope_pb, properties=props, auth_properties=auth_props)
649+
_t2095 = logic_pb2.IcebergConfig(catalog_uri=catalog_uri, scope=scope_opt, properties=props, auth_properties=auth_props)
651650
return _t2095
652651

653652
def construct_export_iceberg_config_full(self, locator: logic_pb2.IcebergLocator, config: logic_pb2.IcebergConfig, columns: Sequence[transactions_pb2.IcebergExportColumn], config_dict: Sequence[tuple[str, logic_pb2.Value]] | None) -> transactions_pb2.ExportIcebergConfig:
@@ -3391,7 +3390,7 @@ def parse_iceberg_data(self) -> logic_pb2.IcebergData:
33913390
_t1942 = None
33923391
iceberg_to_snapshot1184 = _t1942
33933392
self.consume_literal(")")
3394-
_t1944 = logic_pb2.IcebergData(locator=iceberg_locator1181, config=iceberg_config1182, columns=gnf_columns1183, to_snapshot=(iceberg_to_snapshot1184 if iceberg_to_snapshot1184 is not None else ""))
3393+
_t1944 = logic_pb2.IcebergData(locator=iceberg_locator1181, config=iceberg_config1182, columns=gnf_columns1183, to_snapshot=iceberg_to_snapshot1184)
33953394
result1186 = _t1944
33963395
self.record_span(span_start1185, "IcebergData")
33973396
return result1186

0 commit comments

Comments
 (0)