#855 Add COMP-1 and COMP-2 floating point encoders for the writer.#856
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds write support for COBOL ChangesCOMP-1/COMP-2 floating-point write support
Sequence Diagram(s)sequenceDiagram
participant ParserVisitor
participant EncoderSelector
participant SingleFloatHelper as getSingle<br/>FloatingPoint<br/>Encoder
participant DoubleFloatHelper as getDouble<br/>FloatingPoint<br/>Encoder
participant FloatingPointEncoders
ParserVisitor->>EncoderSelector: getEncoder(Decimal(COMP1), floatingPointFormat=IEEE754)
EncoderSelector->>SingleFloatHelper: convert input to Float
SingleFloatHelper->>FloatingPointEncoders: encodeIeee754SingleBigEndian(f)
FloatingPointEncoders-->>SingleFloatHelper: Array[Byte]
SingleFloatHelper-->>EncoderSelector: Encoder
EncoderSelector-->>ParserVisitor: Some(Encoder)
ParserVisitor->>EncoderSelector: getEncoder(Decimal(COMP2), floatingPointFormat=IBM)
EncoderSelector->>DoubleFloatHelper: convert input to Double
DoubleFloatHelper->>FloatingPointEncoders: encodeIbmDoubleBigEndian(d)
FloatingPointEncoders-->>DoubleFloatHelper: Array[Byte]
DoubleFloatHelper-->>EncoderSelector: Encoder
EncoderSelector-->>ParserVisitor: Some(Encoder)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
JaCoCo code coverage report - 'cobol-parser'
|
JaCoCo code coverage report - 'spark-cobol'
|
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
`@cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/EncoderSelector.scala`:
- Line 189: In the getDoubleFloatingPointEncoder method, the fallback case at
line 189 converts values using x.toString.toFloat which causes precision loss.
Change this to x.toString.toDouble to maintain proper double-precision accuracy
when handling non-standard input types in the encoder.
🪄 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
Run ID: 15ddd494-8ff3-45f9-a705-9e95a7a325c6
📒 Files selected for processing (4)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ParserVisitor.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/EncoderSelector.scalacobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/FloatingPointEncoders.scalaspark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/writer/FixedLengthEbcdicWriterSuite.scala
Closes #855
Summary by CodeRabbit
New Features
COMP-1andCOMP-2encoding, including IEEE 754 and IBM variants with selectable endianness (and consistent handling of special values likeNaN/infinities).Bug Fixes
Tests
floating_point_formatoptions with edge-case coverage.