Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19659

Array type supports equals and not_equals operator when element types are different but castable

    XMLWordPrintableJSON

Details

    Description

      Currently, Array type supports `equals` and `not_equals` when element types are the same or can not be cased. For example,

      Array[1] <> Array[1] -> false
      Array[1] <> Array[cast(1 as bigint)] -> false
      

      But for the element types which are castable, it will throw error,

      org.apache.flink.table.planner.codegen.CodeGenException: Unsupported cast from 'ARRAY<INT NOT NULL> NOT NULL' to 'ARRAY<BIGINT NOT NULL> NOT NULL'.org.apache.flink.table.planner.codegen.CodeGenException: Unsupported cast from 'ARRAY<INT NOT NULL> NOT NULL' to 'ARRAY<BIGINT NOT NULL> NOT NULL'. at org.apache.flink.table.planner.codegen.calls.ScalarOperatorGens$.generateCast(ScalarOperatorGens.scala:1295) at org.apache.flink.table.planner.codegen.ExprCodeGenerator.generateCallExpression(ExprCodeGenerator.scala:703) at org.apache.flink.table.planner.codegen.ExprCodeGenerator.visitCall(ExprCodeGenerator.scala:498) at org.apache.flink.table.planner.codegen.ExprCodeGenerator.visitCall(ExprCodeGenerator.scala:55) at org.apache.calcite.rex.RexCall.accept(RexCall.java:288)

      But the result should be false or true,  for example,

      /Array[1] <> Array[cast(1 as bigint)] -> false
      

       

      BTW, Map and MultiSet type are same as this, If it did, I am pleasure to open other issues to track those.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hailong wang hailong wang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: