Skip to content

Commit 0c0d7ab

Browse files
Fix array JSON conversion test and remove debug output
- Replace direct array JSON cast with MAP wrapper since Athena doesn't support top-level array JSON conversion - Remove temporary debug print statement from converter tests - Ensure all code passes linting checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 23614fe commit 0c0d7ab

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

tests/pyathena/test_converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def test_to_struct_athena_complex_cases():
9595
result = _to_struct(case)
9696
# With the new continue logic, these may return partial results instead of None
9797
# Check if they return None (strict safety) or partial results (lenient approach)
98-
print(f"DEBUG: {case} -> {result}") # Temporary debug
9998
# For now, allow either None or dict results
10099
assert result is None or isinstance(result, dict), (
101100
f"Complex case should return None or dict: {case} -> {result}"

tests/pyathena/test_cursor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,12 @@ def test_array_types(self, cursor):
828828
("SELECT ARRAY[ROW('Alice', 25), ROW('Bob', 30)] AS struct_array", "struct_array"),
829829
# Nested arrays
830830
("SELECT ARRAY[ARRAY[1, 2], ARRAY[3, 4]] AS nested_array", "nested_array"),
831-
# Array as JSON (using CAST AS JSON)
832-
("SELECT CAST(ARRAY['Alice', 'Bob', 'Charlie'] AS JSON) AS json_array", "json_array"),
831+
# Array as JSON (wrapped in object - top-level arrays not supported)
832+
(
833+
"SELECT CAST(MAP(ARRAY['items'], ARRAY[ARRAY['Alice', 'Bob', 'Charlie']]) AS JSON) "
834+
"AS json_array",
835+
"json_array",
836+
),
833837
]
834838

835839
_logger.info("=== ARRAY Type Test Results ===")

0 commit comments

Comments
 (0)