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

FLOAT was not supported in method "appendAsJava" of RexLitera.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.26.0, 1.27.0
    • 1.27.0
    • core
    • None

    Description

      the input query

      		String sql="select * from public.test x ,pg.test3 y where x.a=y.a and  x.b between '0.1' and '0.4'";
      

      x.b is float type in database.
      the stacktrace:

      java.lang.UnsupportedOperationException: class org.apache.calcite.sql.type.SqlTypeName: FLOAT
      	at org.apache.calcite.util.Util.needToImplement(Util.java:1075)
      	at org.apache.calcite.rex.RexLiteral.appendAsJava(RexLiteral.java:703)
      	at org.apache.calcite.rex.RexLiteral.toJavaString(RexLiteral.java:408)
      	at org.apache.calcite.rex.RexLiteral.computeDigest(RexLiteral.java:276)
      	at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:223)
      	at org.apache.calcite.rex.RexLiteral.toLiteral(RexLiteral.java:737)
      	at org.apache.calcite.rex.RexLiteral.lambda$printSarg$4(RexLiteral.java:710)
      	at org.apache.calcite.util.RangeSets$Printer.closed(RangeSets.java:402)
      	at org.apache.calcite.util.RangeSets.forEach(RangeSets.java:239)
      	at org.apache.calcite.util.Sarg.lambda$printTo$0(Sarg.java:110)
      	at org.apache.calcite.linq4j.Ord.forEach(Ord.java:157)
      	at org.apache.calcite.util.Sarg.printTo(Sarg.java:106)
      	at org.apache.calcite.rex.RexLiteral.printSarg(RexLiteral.java:709)
      	at org.apache.calcite.rex.RexLiteral.lambda$appendAsJava$1(RexLiteral.java:652)
      	at org.apache.calcite.util.Util.asStringBuilder(Util.java:2502)
      	at org.apache.calcite.rex.RexLiteral.appendAsJava(RexLiteral.java:651)
      	at org.apache.calcite.rex.RexLiteral.toJavaString(RexLiteral.java:408)
      	at org.apache.calcite.rex.RexLiteral.computeDigest(RexLiteral.java:276)
      	at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:223)
      	at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:971)
      	at org.apache.calcite.rex.RexBuilder.makeSearchArgumentLiteral(RexBuilder.java:1066)
      	at org.apache.calcite.rex.RexSimplify$SargCollector.fix(RexSimplify.java:2631)
      	at org.apache.calcite.rex.RexSimplify.lambda$simplifyAnd$4(RexSimplify.java:1305)
      	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
      	at org.apache.calcite.rex.RexSimplify.simplifyAnd(RexSimplify.java:1305)
      	at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:272)
      	at org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:243)
      	at org.apache.calcite.rex.RexSimplify.simplifyUnknownAsFalse(RexSimplify.java:232)
      	at org.apache.calcite.rex.RexSimplify.simplifyFilterPredicates(RexSimplify.java:2484)
      	at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1242)
      	at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1218)
      	at org.apache.calcite.rel.rules.FilterJoinRule.perform(FilterJoinRule.java:177)
      	at org.apache.calcite.rel.rules.FilterJoinRule$FilterIntoJoinRule.onMatch(FilterJoinRule.java:377)
      	at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:333)
      	at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:542)
      	at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:407)
      	at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:243)
      	at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
      	at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:202)
      	at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:189)
      

      it seems in this function "appendAsJava" in RexLiteral.java,it missed the FLOAT in switch.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tonytao0505 TaoJIn
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: