trino
Add more test cases for json_query function
#25783
Open

Add more test cases for json_query function #25783

XavieLee wants to merge 1 commit into trinodb:master from XavieLee:update/testcase/json_query
XavieLee
XavieLee11 days ago (edited 2 days ago)

Description

Add more test cases for json_query function to help developer understand the usage of this function.

Additional context and related issues

Fixes #25545

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

cla-bot cla-bot added cla-signed
XavieLee XavieLee requested a review from kasiafi kasiafi 11 days ago
XavieLee XavieLee requested a review from chenjian2664 chenjian2664 11 days ago
kasiafi
kasiafi approved these changes on 2025-05-23
kasiafi1 day ago

Looks good, just two minor comments.

Conversation is marked as resolved
Show resolved
core/trino-main/src/test/java/io/trino/sql/query/TestJsonQueryFunction.java
426426
427427 @Test
428 public void testDescendantMemberAccessor()
428
public void testDescendantMemberWithArrayWrapperAccessor()
kasiafi1 day ago

Rename to testDescendantMemberAccessorWithArrayWrapper(). The .. operator in an accessor.

Conversation is marked as resolved
Show resolved
core/trino-main/src/test/java/io/trino/sql/query/TestJsonQueryFunction.java
457 @Test
458 public void testDescendantMemberWithoutArrayWrapperAccessor()
459 {
460
// Test `json_query` to find a non-descendant member in the JSON.
kasiafi1 day ago

non-existent

chenjian2664
chenjian2664 approved these changes on 2025-05-24
Conversation is marked as resolved
Show resolved
core/trino-main/src/test/java/io/trino/sql/query/TestJsonQueryFunction.java
465 'lax $..author'
466 omit quotes)
467 """))
468
.matches(
469
"""
470
VALUES cast(NULL as varchar)
471
""");
chenjian266421 hours ago
Suggested change
.matches(
"""
VALUES cast(NULL as varchar)
""");
.matches("VALUES cast(NULL as varchar)");
Conversation is marked as resolved
Show resolved
core/trino-main/src/test/java/io/trino/sql/query/TestJsonQueryFunction.java
478 'lax $..author'
479 omit quotes)
480 """))
481
.matches(
482
"""
483
VALUES cast('Diana' as varchar)
484
""");
chenjian266421 hours ago
Suggested change
.matches(
"""
VALUES cast('Diana' as varchar)
""");
.matches("VALUES cast('Diana' as varchar)");
Conversation is marked as resolved
Show resolved
core/trino-main/src/test/java/io/trino/sql/query/TestJsonQueryFunction.java
493 'lax $..author'
494 omit quotes)
495 """))
496
.matches(
497
"""
498
VALUES cast(NULL as varchar)
499
""");
chenjian266421 hours ago
Suggested change
.matches(
"""
VALUES cast(NULL as varchar)
""");
.matches("VALUES cast(NULL as varchar)");
chenjian266419 hours ago

@XavieLee It's seems still not updated

XavieLee19 hours ago

my mistake, can check it again.

XavieLee XavieLee force pushed from 1f30d936 to 47d6da09 19 hours ago
XavieLee
XavieLee19 hours ago

@chenjian2664 @kasiafi All done, thanks!

XavieLee Add more test cases for json_query function
69bc91e8
XavieLee XavieLee force pushed from 47d6da09 to 69bc91e8 19 hours ago

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone