TaoJIn created CALCITE-4622:
-------------------------------

             Summary: FLOAT was not supported in method "appendAsJava"  of 
RexLitera.java
                 Key: CALCITE-4622
                 URL: https://issues.apache.org/jira/browse/CALCITE-4622
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.26.0, 1.27.0
            Reporter: TaoJIn


the input query
{code:sql}
                String sql="select * from public.test x ,pg.test3 y where 
x.a=y.a and  x.b between '0.1' and '0.4'";
{code}
x.b is float type in database.
the stacktrace:

{code:java}
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)
{code}

it seems in this function ["appendAsJava" in 
RexLiteral.java|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L628],it
 missed the FLOAT in switch.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to