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

Beam Sql - Combine Accumulator return Map fails with class cast exception

Details

    • Bug
    • Status: Triage Needed
    • P3
    • Resolution: Fixed
    • None
    • 2.30.0
    • dsl-sql
    • None

    Description

      Suppose, we have following query where UDAF error_aggregator returns Map<String,String>

      select error_name, error_aggregator(error_types) as error_types_aggregated "
       +"from PCOLLECTION group by error_name").registerUdaf("error_aggregator", new ErrorTypeAggregator()

       

      class ErrorTypeAggregator extends CombineFn<String, String, HashMap<String,String>> {
       ...
      }
      

       

      It fails with following exception.

      Exception in thread "main" org.apache.beam.sdk.extensions.sql.impl.ParseException: Unable to parse query select error_name, error_aggregator(error_types) as error_types_aggregated from PCOLLECTION group by error_nameException in thread "main" org.apache.beam.sdk.extensions.sql.impl.ParseException: Unable to parse query select error_name, error_aggregator(error_types) as error_types_aggregated from PCOLLECTION group by error_name at org.apache.beam.sdk.extensions.sql.impl.CalciteQueryPlanner.convertToBeamRel(CalciteQueryPlanner.java:199) at org.apache.beam.sdk.extensions.sql.impl.BeamSqlEnv.parseQuery(BeamSqlEnv.java:114) at org.apache.beam.sdk.extensions.sql.SqlTransform.expand(SqlTransform.java:140) at org.apache.beam.sdk.extensions.sql.SqlTransform.expand(SqlTransform.java:86) at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:547) at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:481) at org.apache.beam.sdk.values.PCollection.apply(PCollection.java:357) at com.my.company.UdafMapOutput.main(UdafMapOutput.java:70)Caused by: org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.tools.ValidationException: java.lang.ClassCastException: org.apache.beam.vendor.guava.v26_0_jre.com.google.common.reflect.Types$ParameterizedTypeImpl cannot be cast to java.lang.Class at org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:217) at org.apache.beam.sdk.extensions.sql.impl.CalciteQueryPlanner.convertToBeamRel(CalciteQueryPlanner.java:168) ... 7 more

      Attachments

        Issue Links

          Activity

            People

              anup_d anup
              anup_d anup
              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 - 1h 40m
                  1h 40m