#863 Add support for custom AST transformers via the ast_transformers option. - #865
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR adds configurable custom AST transformers to parser APIs and Spark reader options. Transformers are reflectively loaded, applied before built-in transformers, documented, and covered by parser and Spark integration tests. ChangesCustom AST Transformers
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SparkReader
participant CobolParametersParser
participant AstTransformerUtils
participant CobolSchema
participant CopybookParser
SparkReader->>CobolParametersParser: configure ast_transformers
CobolParametersParser->>CobolSchema: pass transformer class names
CobolSchema->>AstTransformerUtils: load transformer classes
AstTransformerUtils-->>CobolSchema: return transformer instances
CobolSchema->>CopybookParser: parseTree with custom transformers
CopybookParser-->>SparkReader: transformed schema and records
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 1664-1668: Update the README Cobrix example to select the data
source with the DataFrameReader format method: replace the reader option for
"format" with the equivalent .format("cobol") call, while preserving the
existing copybook, ast_transformers, and load configuration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2d6a8584-4e2b-4975-ba89-ef6b58d7490d
📒 Files selected for processing (11)
README.mdcobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/CopybookParser.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/reader/parameters/CobolParameters.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/reader/parameters/CobolParametersParser.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/reader/parameters/ReaderParameters.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/reader/schema/CobolSchema.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/utils/AstTransformerUtils.scalacobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/asttransform/AstTransformerSpy.scalacobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/asttransform/ParsingWithAstTransformersSuite.scalaspark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/mocks/AstTransformerSpy.scalaspark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/source/integration/Test44CustomAstTransformersSpec.scala
JaCoCo code coverage report - 'cobol-parser'
|
JaCoCo code coverage report - 'spark-cobol'
|
…ion("format", "cobol")`.
Closes #863
Summary by CodeRabbit
ast_transformersoption (comma-separated for chaining).ReaderParametersconstructor or a no-argument constructor.ast_transformers.