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

ARRAY_REPEAT with a string argument causes a compiler crash

    XMLWordPrintableJSON

Details

    Description

      The following SqlOperatorTest:

          f.checkScalar("array_repeat('1', 2)", "['1', '1']",
              "CHAR(1) NOT NULL ARRAY NOT NULL");
      

      causes a compiler error:

      Error while compiling generated Java code:
      
      ...
      static final String $L4J$C$org_apache_calcite_runtime_SqlFunctions_repeat_1_2_ = org.apache.calcite.runtime.SqlFunctions.repeat("1", 2);
      ...
      	at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
      	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:128)
      	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1171)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:326)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:220)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:666)
      

      This happens because the "repeat" function in SqlFunctions is overloaded to implement both ARRAY_REPEAT and REPEAT.

      Attachments

        Issue Links

          Activity

            People

              mbudiu Mihai Budiu
              mbudiu Mihai Budiu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: