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
27 changes: 21 additions & 6 deletions meta/src/meta/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
%nonterm export_csv_column transactions.ExportCSVColumn
%nonterm export_csv_columns_list Sequence[transactions.ExportCSVColumn]
%nonterm export_csv_config transactions.ExportCSVConfig
%nonterm export_csv_output_location Tuple[String, String]
%nonterm export_csv_path String
%nonterm export_csv_source transactions.ExportCSVSource
%nonterm export_iceberg_config transactions.ExportIcebergConfig
Expand Down Expand Up @@ -1384,10 +1385,10 @@ export
$3: transactions.ExportIcebergConfig = $$.iceberg_config

export_csv_config
: "(" "export_csv_config_v2" export_csv_path export_csv_source csv_config ")"
construct: $$ = construct_export_csv_config_with_source($3, $4, $5)
: "(" "export_csv_config_v2" export_csv_output_location export_csv_source csv_config ")"
construct: $$ = construct_export_csv_config_with_location($3, $4, $5)
deconstruct if builtin.length($$.data_columns) == 0:
$3: String = $$.path
$3: Tuple[String, String] = deconstruct_export_csv_output_location($$)
$4: transactions.ExportCSVSource = $$.csv_source
$5: logic.CSVConfig = $$.csv_config
| "(" "export_csv_config" export_csv_path export_csv_columns_list config_dict ")"
Expand All @@ -1397,6 +1398,16 @@ export_csv_config
$4: Sequence[transactions.ExportCSVColumn] = $$.data_columns
$5: Sequence[Tuple[String, logic.Value]] = deconstruct_export_csv_config($$)

export_csv_output_location
: "(" "path" STRING ")"
construct: $$ = builtin.tuple($3, "")
deconstruct if $$[0] != "":
$3: String = $$[0]
| "(" "transaction_output_name" name ")"
construct: $$ = builtin.tuple("", $3)
deconstruct if $$[1] != "":
$3: String = $$[1]

export_csv_path
: "(" "path" STRING ")"

Expand Down Expand Up @@ -1719,13 +1730,17 @@ def construct_export_csv_config(
syntax_escapechar=builtin.some(syntax_escapechar),
)

def construct_export_csv_config_with_source(
path: String,
def deconstruct_export_csv_output_location(msg: transactions.ExportCSVConfig) -> Tuple[String, String]:
return (msg.path, msg.transaction_output_name)

def construct_export_csv_config_with_location(
location: Tuple[String, String],
csv_source: transactions.ExportCSVSource,
csv_config: logic.CSVConfig,
) -> transactions.ExportCSVConfig:
return transactions.ExportCSVConfig(
path=path,
path=location[0],
transaction_output_name=location[1],
csv_source=csv_source,
csv_config=csv_config,
)
Expand Down
3 changes: 3 additions & 0 deletions meta/src/meta/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ def __post_init__(self):
def target_type(self) -> "TargetType":
if isinstance(self.func, (ParseNonterminal, PrintNonterminal)):
return self.func.target_type()
# builtin.tuple is variadic; infer TupleType from the argument types directly.
if isinstance(self.func, Builtin) and self.func.name == "tuple":
return TupleType(tuple(a.target_type() for a in self.args))
Comment on lines +348 to +350

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this needed? 🤔

@davidwzhao davidwzhao Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new grammar rule i think is the first use of tuples as return values in the grammar, and this exposed a bug in the parser generator. I'm not super sure on the details, but Claude found the problem and this was its fix

func_type = self.func.target_type()
if isinstance(func_type, FunctionType):
# Match parameter types against argument types to build type variable mapping
Expand Down
6 changes: 6 additions & 0 deletions proto/relationalai/lqp/v1/transactions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ message Snapshot {
//

message ExportCSVConfig {
// The following two fields should be in a `oneof`, but compatibility makes that tricky.
// The `path` option should be used if the client needs to output a CSV file to a
// specific location.
// The `transaction_output_name` should be used if the client wants the CSV file to be
// returned as part of the transaction results.
string path = 1;
string transaction_output_name = 12;

ExportCSVSource csv_source = 10;
CSVConfig csv_config = 11;
Expand Down
345 changes: 181 additions & 164 deletions sdks/go/src/lqp/v1/transactions.pb.go

Large diffs are not rendered by default.

Loading
Loading