Skip to content

[BUG][Calcite Engine] Calcite doesn't support cast decimal to double #3437

@qianheng-aws

Description

@qianheng-aws

What is the bug?
When converting a set of literals to Sarg, calcite will throw exception if there is both type of integer and double, although they are both numeric family

Exception stack:

class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')
	at java.base/java.math.BigDecimal.compareTo(BigDecimal.java:305)
	at com.google.common.collect.Range.compareOrThrow(Range.java:702)
	at com.google.common.collect.Cut.compareTo(Cut.java:80)
	at com.google.common.collect.Range.<init>(Range.java:331)
	at com.google.common.collect.Range.create(Range.java:132)
	at com.google.common.collect.Range.closed(Range.java:157)
	at org.apache.calcite.rex.RexBuilder.makeBetween(RexBuilder.java:1805)
	at org.apache.calcite.tools.RelBuilder.between(RelBuilder.java:1153)
	at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:752)
	at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:765)
	at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:736)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcalcitecalcite migration releatedwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions