Skip to content

[TASK-248] Builder pattern for CPP#249

Merged
luoyuxia merged 2 commits into
apache:mainfrom
fresh-borzoni:builder-pattern-cpp
Feb 5, 2026
Merged

[TASK-248] Builder pattern for CPP#249
luoyuxia merged 2 commits into
apache:mainfrom
fresh-borzoni:builder-pattern-cpp

Conversation

@fresh-borzoni
Copy link
Copy Markdown
Member

@fresh-borzoni fresh-borzoni commented Feb 5, 2026

Summary

closes #248

C++ Builder Pattern for Log Scanners

Replaced four separate scanner methods on Table with a fluent TableScan builder.

Before

table.NewLogScanner(scanner);
table.NewLogScannerWithProjection(columns, scanner);
table.NewRecordBatchLogScanner(scanner);
table.NewRecordBatchLogScannerWithProjection(columns, scanner);

After

  table.NewScan().CreateLogScanner(scanner);
  table.NewScan().Project(columns).CreateLogScanner(scanner);
  table.NewScan().CreateRecordBatchScanner(scanner);
  table.NewScan().Project(columns).CreateRecordBatchScanner(scanner);

@fresh-borzoni
Copy link
Copy Markdown
Member Author

@luoyuxia @zhaohaidao Appreciate you review here. PTAL 🙏

Copy link
Copy Markdown

Copilot AI left a comment

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 C++ bindings to use a builder pattern for creating log scanners, aligning with the Rust and Java APIs. The refactoring replaces four separate methods (NewLogScanner, NewLogScannerWithProjection, NewRecordBatchLogScanner, NewRecordBatchLogScannerWithProjection) on the Table class with a fluent TableScan builder pattern.

Changes:

  • Introduced TableScan builder class with Project() method for column projection
  • Replaced four scanner creation methods with NewScan() returning a TableScan builder
  • TableScan provides CreateLogScanner() and CreateRecordBatchScanner() terminal methods
  • Updated all example code to use the new fluent API

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
bindings/cpp/include/fluss.hpp Added TableScan builder class; removed four scanner methods from Table class; added NewScan() method
bindings/cpp/src/table.cpp Implemented TableScan builder with projection support; consolidated scanner creation logic into two terminal methods
bindings/cpp/examples/example.cpp Updated all scanner creation calls to use the new builder pattern API

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

Comment thread bindings/cpp/include/fluss.hpp
Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

@fresh-borzoni Thanks for the pr. Only one minor comment. PTAL

@fresh-borzoni
Copy link
Copy Markdown
Member Author

@luoyuxia Ty for the review. Addressed, PTAL 🙏

Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

@fresh-borzoni Thanks. LGTM.. Merge it. @zhaohaidao Please note the api changes for creating log scanner and feel free to left comment.

@luoyuxia luoyuxia merged commit b18cffb into apache:main Feb 5, 2026
13 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.

refactor create log scanner api to align with rust&java for cpp binding

3 participants