Skip to content

refactor(qdp-core): generic DataReader<T> with FloatElem#1343

Open
0lai0 wants to merge 2 commits into
apache:mainfrom
0lai0:refactor-1339-AddFloatElem
Open

refactor(qdp-core): generic DataReader<T> with FloatElem#1343
0lai0 wants to merge 2 commits into
apache:mainfrom
0lai0:refactor-1339-AddFloatElem

Conversation

@0lai0
Copy link
Copy Markdown
Contributor

@0lai0 0lai0 commented May 29, 2026

Related Issues

Closes #1339
Part of #1338

Changes

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Why

DataReader::read_batch was hard-coded to Vec, so dtype=f32 file sources were silently promoted to f64 before encoding. That blocks a true f32 read path into encode_batch_f32. This PR parameterizes the reader traits so f32 can be added per format without another breaking API change.

How

  • Introduce FloatElem as a sealed-by-usage marker trait (Copy + Send + Sync + 'static) with impls only for f32 and f64.
  • Parameterize DataReader / StreamingDataReader with T: FloatElem, defaulting to f64 so existing impl DataReader for … and call sites (io::read_*_batch, tests, pipeline_runner) compile with no behavior change.
  • Keep null handling and Arrow helpers on f64 for now (handle_float64_nulls).

Follow-up: impl DataReader for Parquet (and other formats as needed), plus pipeline wiring to consume Vec without casting.

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes

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.

[Refactor] Add FloatElem trait and DataReader<T>

1 participant