[ 
https://issues.apache.org/jira/browse/CALCITE-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde resolved CALCITE-3175.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.21.0

Fixed in 
[61b7280|https://github.com/apache/calcite/commit/61b7280ee1167235e3fbd76a6ce379fc83658dbb].
 Thanks for the PR, [~yanlin-Lynn]!

We now serialize enum values as strings. There is a registry of all enum 
classes that may be serialized to JSON, and we know all of the constants in 
those enum classes, and we know they are unique, so when we are deserializing 
JSON and see a string we can convert it back to the right enum value.

> AssertionError while serializing to JSON a RexLiteral with Enum type 
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-3175
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3175
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Wang Yanlin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.21.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Calcite gives an {{AssertionError}} while serializing to JSON a 
> {{RexLiteral}} with enum type.
> For example, serialize the {{RexCall}} of {{TRIM}} function cause 
> *java.lang.AssertionError* exception. The first argument of {{TRIM}} is an 
> {{enum SqlTrimFunction.Flag}} with values {{LEADING}}, {{TRAILING}}, {{BOTH}}.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to