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

Error while compiling LIKE function after update to 1.36

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.36.0
    • None
    • core
    • None

    Description

      After update to calcite v1.36 we are getting the following error on execution of the following query:

      SELECT * FROM "calls_m" WHERE "params"['web.url'] LIKE '%resign%';
      
       -> CompileException: Line 16, Column 174: No applicable constructor/method found for actual parameters "java.lang.Object, java.lang.String"; candidates are: "public boolean org.apache.calcite.runtime.SqlFunctions$LikeFunction.like(java.lang.String, java.lang.String, java.lang.String)", "public boolean org.apache.calcite.runtime.SqlFunctions$LikeFunction.like(java.lang.String, java.lang.String)"
      

      Error.txt
      In v.1.33 it was working fine.
      Generated code from v1.33:
      NormalGenCode.txt
      So, in 1.33 it was calling:

      Boolean.valueOf(org.apache.calcite.runtime.SqlFunctions.like(item_value == null ? (String) null : item_value.toString(), "%resign%"));
      

      but in 1.36 it's:

      Boolean.valueOf($L4J$C$new_org_apache_calcite_runtime_SqlFunctions_LikeFunction_.like(item_value, "%resign%"));
      

      So, it's not calling toString() anymore.
      Looks like it's because it's using reflective implementor instead of method implementor:
      v.1.33

      v.1.36

      org.apache.calcite.adapter.enumerable.RexImpTable.Builder

      Table DDL:

      CREATE TABLE "profiler"."calls_m" (
      	"start_timestamp" TIMESTAMP(3) NOT NULL NOT NULL,
      	"method_id" JavaType(long) NOT NULL NOT NULL,
      	"method_name" JavaType(class java.lang.String),
      	"duration" JavaType(int) NOT NULL NOT NULL,
      	"cpu_time" JavaType(long) NOT NULL NOT NULL,
      	"suspend_duration" JavaType(int) NOT NULL NOT NULL,
      	"queue_wait_duration" JavaType(int) NOT NULL NOT NULL,
      	"memory_used" JavaType(long) NOT NULL NOT NULL,
      	"calls" JavaType(int) NOT NULL NOT NULL,
      	"transactions" JavaType(long) NOT NULL NOT NULL,
      	"logs_generated" JavaType(int) NOT NULL NOT NULL,
      	"logs_written" JavaType(int) NOT NULL NOT NULL,
      	"file_read" JavaType(long) NOT NULL NOT NULL,
      	"file_written" JavaType(long) NOT NULL NOT NULL,
      	"net_read" JavaType(long) NOT NULL NOT NULL,
      	"net_written" JavaType(long) NOT NULL NOT NULL,
      	"node_name" JavaType(class java.lang.String),
      	"thread_name" JavaType(class java.lang.String),
      	"dump_dir_id" JavaType(int) NOT NULL NOT NULL,
      	"trace_id" JavaType(class com.netcracker.profiler.calcite.trace.TraceId),
      	"profiler_url" JavaType(class java.lang.String),
      	"params" JavaType(interface java.util.Map)
      );
      

      Attachments

        1. Error.txt
          5 kB
          Konstantin
        2. NormalGenCode.txt
          4 kB
          Konstantin
        3. image-2024-03-04-12-02-53-920.png
          59 kB
          Konstantin
        4. image-2024-03-04-12-03-15-637.png
          46 kB
          Konstantin

        Activity

          People

            Unassigned Unassigned
            konstantinx64 Konstantin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: