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 12:57:20 UTC

[GitHub] [beam] damccorm opened a new issue, #19730: SELECT COALESCE(...) isn't inferred as non-nullable field

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

   In Calcite, Coalesce is described as:
   
   ```
   
   ReturnTypes.cascade(ReturnTypes.LEAST_RESTRICTIVE,
               SqlTypeTransforms.LEAST_NULLABLE)
   
   ```
   
   
   However, giving non-null constant as an argument doesn't result in a non-nullable expression:
   
   ```
   
       Schema inputSchema = Schema.of(
           Schema.Field.of("name", Schema.FieldType.STRING.withNullable(true)));
   
   
      PCollection<Row> input = p.apply(Create.of(ImmutableList.<Row>of())
           .withCoder(SchemaCoder.of(inputSchema)));
   
   
      Schema outputSchema = input
           .apply(SqlTransform.query("SELECT COALESCE(name, 'unknown')
   as name FROM PCOLLECTION"))
           .getSchema();
   
       assertEquals(
           Schema.builder().addStringField("name").build(),
   
          outputSchema);
   
   ```
   
   
   Not sure if it's a problem in Calcite or Beam SQL.
   
   There are no other functions that can be used to produce a non-nullable field.
   
   
   Imported from Jira [BEAM-7610](https://issues.apache.org/jira/browse/BEAM-7610). Original Jira may contain additional context.
   Reported by: kanterov.


-- 
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


[GitHub] [beam] judahrand commented on issue #19730: SELECT COALESCE(...) isn't inferred as non-nullable field

Posted by GitBox <gi...@apache.org>.
judahrand commented on issue #19730:
URL: https://github.com/apache/beam/issues/19730#issuecomment-1319771260

   This was fixed in Calcite 1.22.0 but I'm still having this issue in Beam 2.39. 


-- 
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

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