Alias name not taking effect in a "over window" query with Beam SQL
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
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):
```
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
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 result = inputRows.apply("sql", SqlTransform.query(sql));
```
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=``}
Imported from Jira [BEAM-11930](https://issues.apache.org/jira/browse/BEAM-11930). Original Jira may contain additional context.
Reported by: sekiforever.
Contributor guide
Assessment
This issue has not been assessed yet.