[
https://issues.apache.org/jira/browse/BEAM-11930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Beam JIRA Bot updated BEAM-11930:
---------------------------------
Priority: P3 (was: P2)
> Alias name not taking effect in a "over window" query with Beam SQL
> -------------------------------------------------------------------
>
> Key: BEAM-11930
> URL: https://issues.apache.org/jira/browse/BEAM-11930
> Project: Beam
> Issue Type: Bug
> Components: dsl-sql
> Reporter: Tao Li
> Priority: P3
> Labels: stale-P2
>
> The problem is that I don’t see the alias column “agg” in the query result's
> schema.
> This is my code (with Beam 2.28):
> {noformat}
> Schema appSchema = Schema
> .builder()
> .addInt32Field("foo")
> .addInt32Field("bar")
> .build();
>
> Row rowOne = Row.withSchema(appSchema).addValues(1, 1).build();
> Row rowTwo = Row.withSchema(appSchema).addValues(1, 2).build();
>
> PCollection<Row> inputRows = pipeline
> .apply(Create.of(rowOne, rowTwo))
> .setRowSchema(appSchema);
>
> String sql = "SELECT foo, bar, RANK() over (PARTITION BY foo ORDER BY
> bar) AS agg FROM PCOLLECTION";
> PCollection<Row> result = inputRows.apply("sql",
> SqlTransform.query(sql));
>
> {noformat}
> The Beam schema of the query result is below. Row name is "w0$o0" instead of
> my specified name "agg".
>
> Field{name=foo, description=, type=FieldType{typeName=INT32, nullable=false,
> logicalType=null, collectionElementType=null, mapKeyType=null,
> mapValueType=null, rowSchema=null, metadata={}}, options={{}}}
> Field{name=bar, description=, type=FieldType{typeName=INT32, nullable=false,
> logicalType=null, collectionElementType=null, mapKeyType=null,
> mapValueType=null, rowSchema=null, metadata={}}, options={{}}}
> Field{name=w0$o0, description=, type=FieldType{typeName=INT64,
> nullable=false, logicalType=null, collectionElementType=null,
> mapKeyType=null, mapValueType=null, rowSchema=null, metadata={}},
> options={{}}}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)