yanlin-Lynn commented on a change in pull request #1301: [CALCITE-3175]
AssertionError during serializing RexLiteral with Enum type.
URL: https://github.com/apache/calcite/pull/1301#discussion_r306608656
##########
File path: core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java
##########
@@ -330,6 +330,9 @@ private Object toJson(RexNode node) {
final Object value = literal.getValue3();
map = jsonBuilder.map();
map.put("literal", value);
+ if (value instanceof Enum) {
+ map.put("flag", value.getClass().getName());
+ }
Review comment:
Actually, I have considered using "type" or "enum". And RexBuilder has the
method
[makeFlag](https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexBuilder.java#L876)
to convert an Enum object to a RexLiteral, which will be used in
`RelJson.toRex` in this patch. So choose "flag" to be in consistent with it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services