Skip to content

Move _normalize_hive_syntax to DefaultTypeConverter and fix converter pass stubs#695

Merged
laughingman7743 merged 1 commit intomasterfrom
refactor/converter-cleanup
Feb 28, 2026
Merged

Move _normalize_hive_syntax to DefaultTypeConverter and fix converter pass stubs#695
laughingman7743 merged 1 commit intomasterfrom
refactor/converter-cleanup

Conversation

@laughingman7743
Copy link
Member

WHAT

  • Move _normalize_hive_syntax from a module-level function in parser.py to a @staticmethod on DefaultTypeConverter, since it is only called from DefaultTypeConverter._parse_type_hint()
  • Replace pass stubs in convert() with self.get(type_)(value) in 4 converter classes:
    • DefaultPandasTypeConverter
    • DefaultPandasUnloadTypeConverter
    • DefaultArrowUnloadTypeConverter
    • DefaultPolarsUnloadTypeConverter

WHY

  • _normalize_hive_syntax was a module-level function but only used by DefaultTypeConverter. Moving it to a staticmethod makes ownership clear and avoids polluting the module namespace. Other converters (Pandas/Arrow/Polars) don't need Hive syntax normalization.
  • The pass stubs in converter convert() methods silently returned None for any input, which could cause data loss if these converters are ever invoked (e.g., via the _fetch_all_rows API fallback path). Replacing with self.get(type_)(value) matches the pattern already used by the non-unload Arrow and Polars converters.

Closes #692.

@laughingman7743 laughingman7743 force-pushed the refactor/converter-cleanup branch from e26db69 to ea43e1e Compare February 28, 2026 14:12
@laughingman7743 laughingman7743 marked this pull request as ready for review February 28, 2026 14:12
- Move _normalize_hive_syntax from module-level function in parser.py
  to a staticmethod on DefaultTypeConverter, since it is only used there
- Move Hive syntax tests from test_parser.py to test_converter.py to
  match the new location
- Replace pass stubs in convert() with self.get(type_)(value) in
  DefaultPandasTypeConverter, DefaultPandasUnloadTypeConverter,
  DefaultArrowUnloadTypeConverter, and DefaultPolarsUnloadTypeConverter
- Add converter tests in each subpackage (pandas, arrow, polars)

Closes #692.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@laughingman7743 laughingman7743 force-pushed the refactor/converter-cleanup branch from ea43e1e to a8df601 Compare February 28, 2026 14:23
@laughingman7743 laughingman7743 merged commit 981e786 into master Feb 28, 2026
29 of 30 checks passed
@laughingman7743 laughingman7743 deleted the refactor/converter-cleanup branch February 28, 2026 15:16
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.

Fix pass-stub convert() in pandas and unload converters

1 participant