You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2021/03/31 23:36:00 UTC
[jira] [Commented] (BEAM-11930) Alias name not taking effect in a
"over window" query with Beam SQL
[ https://issues.apache.org/jira/browse/BEAM-11930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17312779#comment-17312779 ]
Kenneth Knowles commented on BEAM-11930:
----------------------------------------
I think [~apilloud] may be able to route this one.
> 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: 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)