You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "wecharyu (via GitHub)" <gi...@apache.org> on 2025/10/20 16:34:00 UTC

[PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

wecharyu opened a new pull request, #6144:
URL: https://github.com/apache/hive/pull/6144

   ### What changes were proposed in this pull request?
   Return null for invalid index in `get_json_object` udf.
   
   ### Why are the changes needed?
   Fix bug.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Add unit test.
   


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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495071278


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   could we refactor
   ````
     if (indexList.size() > 0) {
       json = extract_json_withindex(json, indexList);
     } else if (path.indexOf('[') >= 0) {
       return null; // index is invalid
     }
   ````



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "wecharyu (via GitHub)" <gi...@apache.org>.
wecharyu commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2521218653


##########
ql/src/test/results/clientpositive/llap/antijoin3.q.out:
##########
@@ -177,7 +177,7 @@ POSTHOOK: Input: default@tabb
 POSTHOOK: Input: default@tabc
 #### A masked pattern was here ####
 CBO PLAN:
-HiveProject(id=[$1], id1=[null:VARCHAR(2147483647) CHARACTER SET "UTF-16LE"], id2=[$0])
+HiveProject(a.id=[$1], b.id=[null:VARCHAR(2147483647) CHARACTER SET "UTF-16LE"], c.id=[$0])

Review Comment:
   This change is introduced in https://github.com/apache/hive/pull/6118



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "wecharyu (via GitHub)" <gi...@apache.org>.
wecharyu commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2519064168


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   Addressed.



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495000499


##########
ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java:
##########
@@ -105,6 +105,9 @@ public void testRootArray() throws HiveException {
     runTest("[1,2,3]", "$0", null, udf);
     runTest("[1,2,3]", "0", null, udf);
     runTest("[1,2,3]", "$.", null, udf);
+    runTest("[1,2,3]", "$[1 ]", null, udf);
+    runTest("[1,2,3]", "$[ 1]", null, udf);
+    runTest("[1,2,3]", "$[invalid]", null, udf);

Review Comment:
   what if we use index -1 or 4 ?



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6144:
URL: https://github.com/apache/hive/pull/6144#issuecomment-3525327622

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144)
   
   


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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ merged PR #6144:
URL: https://github.com/apache/hive/pull/6144


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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495071278


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   ````
     if (indexList.size() > 0) {
       json = extract_json_withindex(json, indexList);
     } else if (path.indexOf('[') >= 0) {
       return null;
     }
   ````



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495000499


##########
ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java:
##########
@@ -105,6 +105,9 @@ public void testRootArray() throws HiveException {
     runTest("[1,2,3]", "$0", null, udf);
     runTest("[1,2,3]", "0", null, udf);
     runTest("[1,2,3]", "$.", null, udf);
+    runTest("[1,2,3]", "$[1 ]", null, udf);
+    runTest("[1,2,3]", "$[ 1]", null, udf);
+    runTest("[1,2,3]", "$[invalid]", null, udf);

Review Comment:
   what if we use -1 or 4 ?



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495000499


##########
ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java:
##########
@@ -105,6 +105,9 @@ public void testRootArray() throws HiveException {
     runTest("[1,2,3]", "$0", null, udf);
     runTest("[1,2,3]", "0", null, udf);
     runTest("[1,2,3]", "$.", null, udf);
+    runTest("[1,2,3]", "$[1 ]", null, udf);
+    runTest("[1,2,3]", "$[ 1]", null, udf);
+    runTest("[1,2,3]", "$[invalid]", null, udf);

Review Comment:
   what if we use index 0 or 4 ?



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6144:
URL: https://github.com/apache/hive/pull/6144#issuecomment-3523287673

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144)
   
   


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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495071278


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   could we refactor
   ````
     if (indexList.size() > 0) {
       json = extract_json_withindex(json, indexList);
     } else if (path.indexOf('[') >= 0) {
       return null;
     }
   ````



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495071278


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   ````
     if (indexList.size() > 0) {
       json = extract_json_withindex(json, indexList);
     } else if (path.indexOf('[') >= 0) {
       return null;
     }
   ````



##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   why do we need to check path?



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495071278


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   ````
     if (indexList.size() > 0) {
       return extract_json_withindex(json, indexList);
     } else if (path.indexOf('[') >= 0) {
       return null;
     }
   ````



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6144:
URL: https://github.com/apache/hive/pull/6144#issuecomment-3423239232

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6144&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6144&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6144&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6144)
   
   


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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495034880


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java:
##########
@@ -239,11 +239,12 @@ private Object extract(Object json, String path, boolean skipMapProc) {
       indexListCache.put(path, indexList);
     }
 
-    if (indexList.size() > 0) {
-      json = extract_json_withindex(json, indexList);
+    if (indexList.isEmpty()) {
+      // Return null if index is invalid.
+      return path.contains("[") ? null : json;

Review Comment:
   why do we need to check path?



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


Re: [PR] HIVE-29277: Invalid index should return null for get_json_object [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #6144:
URL: https://github.com/apache/hive/pull/6144#discussion_r2495000499


##########
ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java:
##########
@@ -105,6 +105,9 @@ public void testRootArray() throws HiveException {
     runTest("[1,2,3]", "$0", null, udf);
     runTest("[1,2,3]", "0", null, udf);
     runTest("[1,2,3]", "$.", null, udf);
+    runTest("[1,2,3]", "$[1 ]", null, udf);
+    runTest("[1,2,3]", "$[ 1]", null, udf);
+    runTest("[1,2,3]", "$[invalid]", null, udf);

Review Comment:
   what if we use index -1 or 4 ?



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