Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-6401

NullPointerException and regression in BeamCalcRel

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 2.12.0
    • dsl-sql
    • None

    Description

      Test case to reproduce:

          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();
      

      Similar test case doesn't throw NPE, but fails:

          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();
      

      Attachments

        Issue Links

          Activity

            People

              apilloud Andrew Pilloud
              kanterov Gleb Kanterov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m