[ 
https://issues.apache.org/jira/browse/BEAM-6401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Pilloud resolved BEAM-6401.
----------------------------------
    Resolution: Fixed

> NullPointerException and regression in BeamCalcRel
> --------------------------------------------------
>
>                 Key: BEAM-6401
>                 URL: https://issues.apache.org/jira/browse/BEAM-6401
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Gleb Kanterov
>            Assignee: Andrew Pilloud
>            Priority: Major
>              Labels: triaged
>             Fix For: 2.12.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Test case to reproduce:
> {code}
>     Schema schema =
>         Schema.builder()
>             .addNullableField("f0", Schema.FieldType.BOOLEAN)
>             .build();
>     String sql =
>         "SELECT SUM(case when coalesce(f0, true) = true then 1 else 0 end) " +
>         "FROM PCOLLECTION";
>     List<Row> rows = ImmutableList.of(
>         Row.withSchema(schema).addValue(false).build(),
>         Row.withSchema(schema).addValue(true).build(),
>         Row.withSchema(schema).addValue(null).build());
>     PCollection<Row> input = pipeline.apply("rows", 
> Create.of(rows).withRowSchema(schema));
>     
> PAssert.that(input.apply(SqlTransform.query(sql))).satisfies(matchesScalar(2));
>     pipeline.run();
> {code}
> Similar test case doesn't throw NPE, but fails:
> {code}
>     Schema schema =
>         Schema.builder()
>             .addNullableField("f0", Schema.FieldType.BOOLEAN)
>             .build();
>     String sql =
>         "SELECT SUM(case when coalesce(f0, false) = true then 1 else 0 end) " 
> +
>         "FROM PCOLLECTION";
>     List<Row> rows = ImmutableList.of(
>         Row.withSchema(schema).addValue(false).build(),
>         Row.withSchema(schema).addValue(true).build(),
>         Row.withSchema(schema).addValue(null).build());
>     PCollection<Row> input = pipeline.apply("rows", 
> Create.of(rows).withRowSchema(schema));
>     
> PAssert.that(input.apply(SqlTransform.query(sql))).satisfies(matchesScalar(1));
>     pipeline.run();
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to