You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
goldmedal
changed the title
Introduce DereferenceExpr to enhance the struct accessing
Improve CompositeAccess to enhance the struct type using
Nov 20, 2024
goldmedal
changed the title
Improve CompositeAccess to enhance the struct type using
Improve CompositeAccess to enhance the struct type
Nov 20, 2024
Problem
Currently, we support struct syntax such as:
However, if the column is a struct array, we cannot use SQL like:
Additionally, we cannot access fields in structs created using a function (e.g.,
named_struct
, the corresponding function in DataFusion):To address this, we could use the
Expr::MapAccess
approach:However, the
.
syntax is more commonly used for structs, as seen in systems like DuckDB or BigQuery.Proposal
Inspired from how Trino handles such expressions (DereferenceExpression), I propose introducing a newExpr
variant:This could potentially replaceCompoundIdentifier
, as the latter is essentially a specific case ofDereferenceExpr
:However, this change might break downstream projects. I prefer not to make such a breaking change in this issue.After some research, I found thatCompositeAccess
has the same structure. We can enhance it to support the struct field access.MapAccess
is the better way.The text was updated successfully, but these errors were encountered: