Implement Pretty Formatting Improvements for 6 Complex Misc SQL Test Cases #154
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.
Implement Pretty Formatting Improvements for 6 Complex Misc SQL Test Cases
This PR implements comprehensive pretty formatting improvements for 6 complex misc SQL test cases, focusing on CTEs, window functions, lateral joins, and complex WHERE clauses.
🎯 Overview
Building on the existing pretty formatting infrastructure, this PR enhances the deparser's ability to format complex SQL constructs with improved readability while maintaining strict AST equivalence.
✨ Key Improvements
1. Enhanced CaseExpr Formatting
2. Improved WindowDef Formatting
3. Enhanced JoinExpr Formatting
4. String Literal Preservation
containsMultilineStringLiteral()helper method🧪 Test Coverage
New Test Suite:
misc-pretty.test.tsCreated comprehensive test coverage for 6 complex SQL scenarios:
Snapshot Testing
expectParseDeparse()helper🔧 Technical Details
Core Changes
Bug Fixes
📊 Test Results
🎨 Formatting Examples
Before (misc-4):
After (misc-4):
🚀 Impact
🔗 Related Work
Link to Devin run: https://app.devin.ai/sessions/e2a49c9a83094092a217b1c66ad778de
Requested by: Dan Lynch ([email protected])
Testing: All changes have been thoroughly tested with AST validation to ensure semantic preservation across different formatting options.