You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/09/27 13:20:02 UTC

[GitHub] [hive] abstractdog commented on a change in pull request #2664: HIVE-25541: JsonSerDe: TBLPROPERTY treating nested json as String

abstractdog commented on a change in pull request #2664:
URL: https://github.com/apache/hive/pull/2664#discussion_r716683867



##########
File path: serde/src/java/org/apache/hadoop/hive/serde2/json/HiveJsonReader.java
##########
@@ -393,7 +402,16 @@ private Object visitLeafNode(final JsonNode leafNode,
     case DOUBLE:
       return Double.valueOf(leafNode.asDouble());
     case STRING:
-      return leafNode.asText();
+      if (leafNode.isValueNode()) {
+        return leafNode.asText();
+      } else {
+        if (isEnabled(Feature.STRINGIFY_COMPLEX_FIELDS)) {
+          return leafNode.toString();
+        } else {
+          throw new SerDeException(
+              "Complex field found in JSON does not match table definition: " + typeInfo.getTypeName());

Review comment:
       what about giving a very brief hint of using the new feature in this exception message?
   with a hint, the user can simply turn on enabling STRINGIFY_COMPLEX_FIELDS, without hint, user doesn't even know there is a quick way of getting rid of this exception / query failure...




-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org