comphead commented on code in PR #21264:
URL: https://github.com/apache/datafusion/pull/21264#discussion_r3030539711
##########
datafusion/sqllogictest/test_files/spark/json/json_tuple.slt:
##########
@@ -147,6 +147,58 @@ SELECT
json_tuple('{"имя":"Иван","город":"Москва"}'::STRING, '
----
{c0: Иван, c1: Москва}
+# ── Additional edge cases ────────────────────────────────────
+
+# Trailing comma in JSON is invalid → NULL
+query ?
+SELECT json_tuple('{"a":1,}'::STRING, 'a'::STRING);
+----
+NULL
+
+# Empty string as key
+query ?
+SELECT json_tuple('{"":1}'::STRING, ''::STRING);
+----
+{c0: 1}
+
+# "null" as key name (not JSON null, literal key)
+query ?
+SELECT json_tuple('{"null":1}'::STRING, 'null'::STRING);
+----
+{c0: 1}
+
+# Interleaved existing and missing fields
+query ?
+SELECT json_tuple('{"a":1,"c":3}'::STRING, 'a'::STRING, 'b'::STRING,
'c'::STRING, 'd'::STRING);
+----
+{c0: 1, c1: NULL, c2: 3, c3: NULL}
+
+# ── Number precision (raw text preservation) ─────────────────
+
+# Scientific notation: Spark returns uppercase exponent
+query ?
+SELECT json_tuple('{"v":1.5e10}'::STRING, 'v'::STRING);
+----
+{c0: 1.5E10}
+
+# Large integer: preserved without float conversion
+query ?
+SELECT json_tuple('{"v":99999999999999999999}'::STRING, 'v'::STRING);
+----
+{c0: 99999999999999999999}
+
+# Normal integer
+query ?
Review Comment:
mey be we need also tests for
```
-- Missing key
SELECT json_tuple('{"a":1}', 'b');
-- Tests behavior when requested key does not exist
-- Dot notation attempt
SELECT json_tuple('{"a":{"b":1}}', 'a.b');
-- Confirms dot notation is not supported
-- Deep nesting
SELECT json_tuple('{"a":{"b":{"c":{"d":1}}}}', 'a');
-- Tests extraction of nested object as string
-- Duplicate keys
SELECT json_tuple('{"a":1,"a":2}', 'a');
-- Tests duplicate key resolution (last wins)
-- Array field
SELECT json_tuple('{"a":[1,2,3]}', 'a');
```
I checked quickly in existing tests, seems those areas still uncovered
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]