You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 19:08:13 UTC

[GitHub] [beam] damccorm opened a new issue, #20746: Alias name not taking effect in a "over window" query with Beam SQL

damccorm opened a new issue, #20746:
URL: https://github.com/apache/beam/issues/20746

   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<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));
    
   
   ```
   
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org