[
https://issues.apache.org/jira/browse/FLINK-18002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17120138#comment-17120138
]
Benchao Li commented on FLINK-18002:
------------------------------------
[~jark] I looked into this problem a little deeper, here is the result:
# asText() method is correct in most cases, except for ContainerNode, which
will be empty string.
# toString() method is correct in most cases too, except for
TextNode/BinaryNode, which will add additional quotes to the string.
# for most of ValueNode(IntNode/LongNode/FloatNode/DoubleNode/NullNode etc.),
toString() is delegated to asText() method.
Hence, we can use toString() for ContainerNode, and asText() for others.
IMHO, it's about correctness, rather than performance here, WDYT?
> Support forcing varchar type in Json format
> -------------------------------------------
>
> Key: FLINK-18002
> URL: https://issues.apache.org/jira/browse/FLINK-18002
> Project: Flink
> Issue Type: Improvement
> Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
> Reporter: Benchao Li
> Priority: Minor
>
> Currently in json format, if the field type is varchar, we will call
> `JsonNode.asText()` which we always assumes the JsonNode is a TextNode.
> However, in many cases, we want to force it as varchar for other types, etc
> ObjectNode. We should use `JsonNode.toString()` for other JsonNode instead of
> `JsonNode.asText()`.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)