Skip to content

Conversation

@mach-kernel
Copy link

@mach-kernel mach-kernel commented Sep 23, 2025

When encountering FunctionArg::ExprNamed nodes with "pg-style" function arguments, if the logical expression output is a literal, decorate its name/ident value to FieldMetadata.

Also has the side effect of supporting ExprNamed as Named is currently supported (I don't see why it shouldn't). I didn't see a way to do this with ExprPlanner.

Adding a TODO on our board to revert this patch once this ships:
apache#17379


Gives us the ability to support RRF with named boosting subquery arguments:

SELECT id, title, fused_score
FROM rrf(
    vector_search(wiki_a_potion, 'machine learning algorithms', rank_boost => 10),
    text_search(wiki_a_potion, 'neural networks deep learning')
 );

Gives us the ability to provide named arguments to RRF:

SELECT id, title, fused_score
FROM rrf(
    vector_search(wiki_a_potion, 'machine learning algorithms', rank_boost => 10),
    text_search(wiki_a_potion, 'neural networks deep learning'),
    recency_decay_algorithm => 'exponential'
 );

...

[Column(Column { relation: None, name: "wiki_a_potion" }), Literal(Utf8("machine learning algorithms"), None), Literal(Int64(10), Some(FieldMetadata { inner: {"spice.parameter_name": "rank_boost"} }))]

@mach-kernel mach-kernel merged commit b687ce4 into spiceai-49 Sep 25, 2025
@mach-kernel mach-kernel deleted the mach/allow-udtf-named-arg-exprs branch September 25, 2025 13:26
peasee pushed a commit that referenced this pull request Oct 27, 2025
* support ExprNamed until 17379 ships

* add same exprnamed lifting to udtf
peasee added a commit that referenced this pull request Oct 27, 2025
* fix: Ensure only tables or aliases that exist are projected (#52)
fix: More dangling references (#54)

UPSTREAM NOTE: This PR was attempted to be upstreamed in apache#13405 - but it was not accepted due to the complexity it brought. Phillip needs to figure out what a good solution that solves our problem and can be upstreamed is.

* Support for metadata columns (`location`, `size`, `last_modified`)  in ListingTableProvider (#74)

UPSTREAM NOTE: This PR was attempted to be upstreamed but was not accepted. Needs to be applied manually
apache#15181

* Infer placeholder datatype for `Expr::InSubquery` (#80)

UPSTREAM NOTE: Upstream PR has been created but not merged yet. Should be available in DF49
apache#15980

* Infer placeholder datatype after `LIMIT` clause as `DataType::Int64` (#81)

UPSTREAM NOTE: Upstream PR has been created but not merged yet. Should be available in DF49
apache#15980

* Do not double alias Exprs

UPSTREAM NOTE: This was attempted to be fixed with
apache#15008 but was closed

This is the tracking issue on DataFusion:
apache#14895
Do not double alias Exprs

* Add prefix to location metadata column (#82)

UPSTREAM NOTE: This will not be upstreamed as is.

* Infer placeholder types for CASE expressions (#87)

UPSTREAM NOTE: This has not been submitted upstream yet.

* Expand `infer_placeholder_types` to infer all possible placeholder types based on their expression (#88)

UPSTREAM NOTE: This has not been submitted upstream yet.

* Fix `Expr::infer_placeholder_types` inference to not fail (#89)

UPSTREAM NOTE: This has not been submitted upstream yet.

* cherry-pick parquet patch (#94)

* Fix array types coercion: preserve child element nullability for list types (#96)

UPSTREAM NOTE: This was submitted upstream and should be available in DF50

apache#17306

* Expand `infer_placeholder_types` to infer all possible placeholder types based on their expression (#88)

UPSTREAM NOTE: This has not been submitted upstream yet.

* do not enforce type guarantees on all Expr traversed in infer_placeholder_types (#97)

* Use UDTF function args in `LogicalPlan::TableScan` name (#98)

* use UDTF function args in LogicalPlan::TableScan name

* update test snapshots

* Implement timestamp_cast_dtype for SqliteDialect (#99)

* Use text for sqlite timestamp

* Add test

* Custom timestamp format for DuckDB (#102)

* Revert "cherry-pick parquet patch (#94)"

This reverts commit d780cc2.

* Support ExprNamed arguments to Scalar UDFs (#104)

* support ExprNamed until 17379 ships

* add same exprnamed lifting to udtf

* resolve projection against `ListingTable` table_schema incl. partition columns (#106)

* fix: Ensure ListingTable partitions are pruned when filters are not used (#108)

* fix: Prune partitions when no filters are defined

* fix: Backport for DF49:

* review: Address comments

* FileScanConfig: Preserve schema metadata across serde boundary (#107)

* FileScanConfig: preserve schema metadata across serde boundary

* add test

* Merge conflict fixes

UPSTREAM NOTE: this should not be upstreamed. This contains conflict fixes from various cherry-picks and differences in v50.

* update arrow-rs fork

UPSTREAM NOTE: this should not be upstreamed

---------

Co-authored-by: Phillip LeBlanc <[email protected]>
Co-authored-by: Kevin Zimmerman <[email protected]>
Co-authored-by: sgrebnov <[email protected]>
Co-authored-by: jeadie <[email protected]>
Co-authored-by: Jack Eadie <[email protected]>
Co-authored-by: Viktor Yershov <[email protected]>
Co-authored-by: Viktor Yershov <[email protected]>
Co-authored-by: David Stancu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants