Add DDL compilation tests for ARRAY, MAP, and STRUCT types#591
Merged
Conversation
Add DDL compilation tests for ARRAY, MAP, and STRUCT types in SQLAlchemy: - test_create_table_with_array_types: Tests ARRAY<STRING>, nested arrays, struct arrays - test_create_table_with_map_types: Tests MAP types with complex values - test_create_table_with_struct_types: Tests ROW types with nested structures - test_create_table_with_complex_nested_types: Tests deeply nested combinations Key features tested: - Basic ARRAY<STRING>, ARRAY<INTEGER> types - Nested arrays: ARRAY<ARRAY<STRING>> - Arrays of structs: ARRAY<ROW(name STRING, age INTEGER)> - Maps with struct values: MAP<STRING,ROW(...)> - Structs with array/map fields: ROW(tags ARRAY<STRING>, ...) - Complex nested: ARRAY<MAP<STRING,ROW(...)>> All assertions use correct Athena SQL syntax with ROW(...) format for structs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix MAP type assertions to include spaces in generated DDL: - MAP<STRING,STRING> -> MAP<STRING, STRING> - MAP<STRING,INTEGER> -> MAP<STRING, INTEGER> This matches the actual SQLAlchemy compiler output which includes spaces after commas in type parameter lists. Fixes CI test failures: - test_create_table_with_map_types - test_create_table_with_struct_types (nested MAP parts) - test_create_table_with_complex_nested_types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive DDL compilation tests for complex data types (ARRAY, MAP, STRUCT) in SQLAlchemy integration.
This PR addresses the gap in testing DDL compilation for complex types by adding dedicated test functions that verify the correct SQL generation for table creation with these types.
Changes
New Test Functions
test_create_table_with_array_types: Tests ARRAY type DDL compilationARRAY<STRING>,ARRAY<INTEGER>ARRAY<ARRAY<STRING>>ARRAY<ROW(name STRING, age INTEGER)>test_create_table_with_map_types: Tests MAP type DDL compilationMAP<STRING,STRING>,MAP<STRING,INTEGER>MAP<STRING,ROW(...)>MAP<STRING,ARRAY<STRING>>test_create_table_with_struct_types: Tests STRUCT/ROW type DDL compilationROW(name STRING, age INTEGER, email STRING)ROW(personal ROW(...), preferences MAP<...>)ROW(tags ARRAY<STRING>, scores ARRAY<INTEGER>)test_create_table_with_complex_nested_types: Tests deeply nested combinationsARRAY<MAP<STRING,ROW(value STRING, metadata MAP<STRING,STRING>, tags ARRAY<STRING>)>>Implementation Details
ROW(...)format for STRUCT typesCreateTableDDL with PyAthena dialecttest_base.pyTest Coverage
Test Plan
This complements the existing runtime type conversion tests by ensuring the DDL generation works correctly for complex type definitions.
🤖 Generated with Claude Code