Skip to content

[TASK-432] Typed Column Writers - #440

Merged
luoyuxia merged 4 commits into
apache:mainfrom
fresh-borzoni:typed-column-writers
Mar 11, 2026
Merged

[TASK-432] Typed Column Writers#440
luoyuxia merged 4 commits into
apache:mainfrom
fresh-borzoni:typed-column-writers

Conversation

@fresh-borzoni

@fresh-borzoni fresh-borzoni commented Mar 10, 2026

Copy link
Copy Markdown
Member

Summary

closes #432

Eliminates triple dispatch (FieldGetter enum, Datum allocation, downcast_mut) in the Arrow write path by introducing ColumnWriter, a typed enum that resolves the concrete Arrow builder at construction time and writes directly from InternalRow in a single dispatch.

Changes

  • New ColumnWriter struct with TypedWriter enum (24 variants covering all Fluss types)
  • RowAppendRecordBatchBuilder now uses Vec instead of Vec<Box> + Box<[FieldGetter]>

@fresh-borzoni

fresh-borzoni commented Mar 10, 2026

Copy link
Copy Markdown
Member Author

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Arrow write path to avoid per-value triple dispatch by introducing typed column writers that resolve concrete Arrow builders up-front and write directly from InternalRow.

Changes:

  • Adds row::column_writer::ColumnWriter with a TypedWriter enum covering supported Fluss scalar types.
  • Refactors RowAppendRecordBatchBuilder to use Vec<ColumnWriter> instead of Vec<Box<dyn ArrayBuilder>> plus FieldGetter/Datum conversion.
  • Extracts shared decimal rescaling/append logic into a reusable helper in row::datum.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
crates/fluss/src/row/mod.rs Exposes datum crate-wide and adds the new column_writer module.
crates/fluss/src/row/datum.rs Makes time conversion helpers crate-visible and factors out append_decimal_to_builder.
crates/fluss/src/row/column_writer.rs Introduces typed writers to append directly from InternalRow into concrete Arrow builders.
crates/fluss/src/record/arrow.rs Switches row-appending record batch builder to ColumnWriter and updates relevant tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/fluss/src/row/mod.rs Outdated
Comment thread crates/fluss/src/row/column_writer.rs
Comment thread crates/fluss/src/row/column_writer.rs
Comment thread crates/fluss/src/row/column_writer.rs
@fresh-borzoni

Copy link
Copy Markdown
Member Author

Addressed comments

@charlesdong1991 charlesdong1991 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice PR! just two nit comments

Comment thread crates/fluss/src/row/column_writer.rs Outdated
Comment thread crates/fluss/src/row/column_writer.rs
@fresh-borzoni

Copy link
Copy Markdown
Member Author

@charlesdong1991 Addressed comments, PTAL

@fresh-borzoni

Copy link
Copy Markdown
Member Author

fixed clippy warning

@luoyuxia luoyuxia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fresh-borzoni Thanks. LGTM. Merging...

@luoyuxia
luoyuxia merged commit 599a223 into apache:main Mar 11, 2026
8 checks passed
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.

Replace FieldGetter/Datum dispatch with typed column writers

4 participants