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

NullPointerException and regression in BeamCalcRel

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.12.0
    • Component/s: dsl-sql
    • Labels:
      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

              • Assignee:
                apilloud Andrew Pilloud
                Reporter:
                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