raminqaf commented on code in PR #29617:
URL: https://github.com/apache/flink/pull/29617#discussion_r4401669915


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/VariantSemanticTest.java:
##########
@@ -111,6 +111,54 @@ public class VariantSemanticTest extends SemanticTestBase {
                     .runSql("INSERT INTO sink_t SELECT TRY_PARSE_JSON(v) FROM 
t")
                     .build();
 
+    static final String JSON_OBJECT_A_AND_B = "{\"a\": 1, \"b\": 2}";
+
+    static final TableTestProgram TRY_VARIANT_GET_PATH_PER_ROW =
+            TableTestProgram.of(
+                            "try-variant-get-path-per-row",
+                            "validates TRY_VARIANT_GET reads a path that 
changes from row to row")
+                    .setupTableSource(
+                            SourceTestStep.newBuilder("t")
+                                    .addSchema("v STRING", "p STRING")
+                                    .producedValues(
+                                            Row.of(JSON_OBJECT_A_AND_B, "$.a"),
+                                            Row.of(JSON_OBJECT_A_AND_B, "$.c"),
+                                            Row.of(JSON_OBJECT_A_AND_B, "$.b"),
+                                            Row.of(JSON_OBJECT_A_AND_B, 
"$.a["),
+                                            Row.of(JSON_OBJECT_A_AND_B, "$.b"))

Review Comment:
   On purpose. The second `$.b` comes right after the malformed `$.a[`. A path 
cache that kept its key on an error would return NULL there instead of 2. I 
added a comment.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to