Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4579

Piglet throws ClassCastException if Pig Latin script contains FLATTEN or STRSPLIT operators

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      In the piglet component, while converting a Pig Latin script to SQL, the conversion expects the child to be a SqlIdentifier. But a SqlBasicCall is returned.

      Script

      A = LOAD 'scott.DEPT' as (DEPTNO:int, DNAME:chararray, LOC:CHARARRAY);
      B = FOREACH A GENERATE FLATTEN(STRSPLIT(DNAME, ',')) as NAMES;
       
          java.lang.ClassCastException: org.apache.calcite.sql.SqlBasicCall cannot be cast to org.apache.calcite.sql.SqlIdentifier
              at org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:720)
              at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:351)
              at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
              at org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:134)
              at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:142)
              at org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:185)
              at org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:173)
              at org.apache.calcite.rel.rel2sql.SqlImplementor.visitRoot(SqlImplementor.java:153)
              at org.apache.calcite.piglet.PigConverter.pigToSql(PigConverter.java:244)
              at org.apache.calcite.piglet.PigConverter.pigToSql(PigConverter.java:227)
              at org.apache.calcite.test.PigRelOpTest$Fluent.assertSql(PigRelOpTest.java:100)
              at org.apache.calcite.test.PigRelOpTest$Fluent.access$200(PigRelOpTest.java:64)
              at org.apache.calcite.test.PigRelOpTest.testUdf(PigRelOpTest.java:286) 

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            maheshk114 mahesh kumar behera
            Votes:
            0 Vote for this issue
            Watchers:
            3 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 - 20m
                20m

                Slack

                  Issue deployment