Skip to content

Conversation

@wecharyu
Copy link
Contributor

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.

@sonarqubecloud
Copy link

json = extract_json_withindex(json, indexList);
if (indexList.isEmpty()) {
// Return null if index is invalid.
return path.contains("[") ? null : json;
Copy link
Member

@deniskuzZ deniskuzZ Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we refactor

  if (indexList.size() > 0) {
    json = extract_json_withindex(json, indexList);
  } else if (path.indexOf('[') >= 0) {
    return null; // index is invalid
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants