You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sergey Nuyanzin (Jira)" <ji...@apache.org> on 2026/04/17 07:08:00 UTC
[jira] [Commented] (FLINK-39253) row() does not preserve field names from AS aliases and field references
[ https://issues.apache.org/jira/browse/FLINK-39253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074174#comment-18074174 ]
Sergey Nuyanzin commented on FLINK-39253:
-----------------------------------------
Merged as [ee827dfcebf09aad25f26782e865027e8639e04d|https://github.com/apache/flink/commit/ee827dfcebf09aad25f26782e865027e8639e04d]
> row() does not preserve field names from AS aliases and field references
> ------------------------------------------------------------------------
>
> Key: FLINK-39253
> URL: https://issues.apache.org/jira/browse/FLINK-39253
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API, Table SQL / Planner
> Reporter: Mika Naylor
> Assignee: Mika Naylor
> Priority: Major
> Labels: pull-request-available
>
> The {{row()}} function currently ignores field names/aliases provided through {{AS}} expressions or field references, always generating default names ({{{}f0, f1, f2, etc.{}}}) instead.
> When creating a ROW with explicitly named fields using AS aliases or field references, the resulting ROW type should preserve those names:
>
> {code:java}
> row($("f0").as("customer_id"), $("f1").as("product_id"))
> // Should produce: ROW<customer_id INT, product_id STRING>{code}
>
> but in actuality, the field names are lost and default names are used
>
> {code:java}
> row($("f0").as("customer_id"), $("f1").as("product_id"))
> // Currently produces: ROW<f0 INT, f1 STRING> {code}
> This makes the following kinds of expressions impossible:
>
> {code:java}
> env.from("example_order_passthrough")
> .select(
> $("order_id"),
> row(
> $("customer_id").as("customer_id"),
> $("product_id").as("product_id"),
> $("price").as("price"))
> .as("details"))
> .where($("details").get("price").isGreaterOrEqual(50))
> .execute()
> .print(); {code}
> as they fail with:
>
> {code:java}
> Exception in thread "main" org.apache.flink.table.api.ValidationException: Invalid function call:
> get(ROW<`f0` INT, `f1` STRING, `f2` DOUBLE> NOT NULL, CHAR(5) NOT NULL) {code}
> Necessitating either using {{f2}} or using a cast as a workaround.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)