Skip to content

Refactor C++ sources: fix bugs, reduce duplication, improve consistency#423

Open
WillAyd wants to merge 1 commit intomainfrom
roborev
Open

Refactor C++ sources: fix bugs, reduce duplication, improve consistency#423
WillAyd wants to merge 1 commit intomainfrom
roborev

Conversation

@WillAyd
Copy link
Copy Markdown
Collaborator

@WillAyd WillAyd commented Mar 16, 2026

  • Fix log_config erasure bug: process_params.erase() was deleting user-provided log_config values instead of keeping them. Replaced with emplace() semantics.
  • Extract MakeHyperProcess() helper into hyper_process.hpp to deduplicate HyperProcess setup across reader.cpp, writer.cpp, and libpantab.cpp.
  • Fix throw "unreachable" (const char*) to throw std::logic_error, making exceptions catchable as std::exception.
  • Fix typo "unknownn" -> "unknown" in error message and fix misleading "ArrowAppendString failed" in BytesReadHelper.
  • Extract PrecisionLimit constant as kMaxNumericPrecision/kNumericVariantSize in numeric_gen.hpp, replacing 3 duplicated magic number definitions.
  • Refactor ReadHelper to use template method pattern: null checking is now handled once in the base class Read() method, with subclasses overriding ReadNonNull() instead. Eliminates ~60 lines of duplicated null checks.
  • Deduplicate timestamp switch in MakeInsertHelper via MakeTimestampInsertHelper template helper, reducing 8 near-identical branches to 4 one-line calls.

closes #xxx

- Fix log_config erasure bug: process_params.erase() was deleting user-provided
  log_config values instead of keeping them. Replaced with emplace() semantics.
- Extract MakeHyperProcess() helper into hyper_process.hpp to deduplicate
  HyperProcess setup across reader.cpp, writer.cpp, and libpantab.cpp.
- Fix throw "unreachable" (const char*) to throw std::logic_error, making
  exceptions catchable as std::exception.
- Fix typo "unknownn" -> "unknown" in error message and fix misleading
  "ArrowAppendString failed" in BytesReadHelper.
- Extract PrecisionLimit constant as kMaxNumericPrecision/kNumericVariantSize
  in numeric_gen.hpp, replacing 3 duplicated magic number definitions.
- Refactor ReadHelper to use template method pattern: null checking is now
  handled once in the base class Read() method, with subclasses overriding
  ReadNonNull() instead. Eliminates ~60 lines of duplicated null checks.
- Deduplicate timestamp switch in MakeInsertHelper via MakeTimestampInsertHelper
  template helper, reducing 8 near-identical branches to 4 one-line calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant