[ 
https://issues.apache.org/jira/browse/HIVE-25541?focusedWorklogId=657818&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-657818
 ]

ASF GitHub Bot logged work on HIVE-25541:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Sep/21 00:27
            Start Date: 30/Sep/21 00:27
    Worklog Time Spent: 10m 
      Work Description: dengzhhu653 commented on a change in pull request #2664:
URL: https://github.com/apache/hive/pull/2664#discussion_r718082739



##########
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:
       Sorry for this, I wonder that if the column is defined as varchar or 
char in hive schema, but corresponds to a complex field the in json, should we 
do something for such cases?
   Thanks




-- 
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-unsubscr...@hive.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 657818)
    Time Spent: 2h  (was: 1h 50m)

> JsonSerDe: TBLPROPERTY treating nested json as String
> -----------------------------------------------------
>
>                 Key: HIVE-25541
>                 URL: https://issues.apache.org/jira/browse/HIVE-25541
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Panagiotis Garefalakis
>            Assignee: Panagiotis Garefalakis
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Native Jsonserde 'org.apache.hive.hcatalog.data.JsonSerDe' currently does not 
> support loading nested json into a string type directly. It requires the 
> declaring the column as complex type (struct, map, array) to unpack nested 
> json data.
> Even though the data field is not a valid JSON String type there is value 
> treating it as plain String instead of throwing an exception as we currently 
> do.
> {code:java}
> create table json_table(data string, messageid string, publish_time bigint, 
> attributes string);
> {"data":{"H":{"event":"track_active","platform":"Android"},"B":{"device_type":"Phone","uuid":"[36ffec24-f6a4-4f5d-aa39-72e5513d2cae,11883bee-a7aa-4010-8a66-6c3c63a73f16]"}},"messageId":"2475185636801962","publish_time":1622514629783,"attributes":{"region":"IN"}}"}}
> {code}
> This JIRA introduces an extra Table Property allowing to Stringify Complex 
> JSON values instead of forcing the User to define the complete nested 
> structure



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to