taozhiyi13 opened a new pull request, #12738: URL: https://github.com/apache/seatunnel/pull/12738
### Purpose of this pull request `flushBatch()` buffers rows, then calls `Fragment.create()` once per row. Each call writes one `.lance` file, so a flush of N rows produces N fragments. `Append.commit()` only publishes the metadata and does not merge the files. Write the whole buffer into one Arrow batch and call `Fragment.create()` once per flush. Remove the single-row `reconvert()` entry point. Add `lance.write.batch-size` (default `10000`, must be greater than 0) to control how many rows go into that fragment. The previous hard-coded threshold was 1000. Writing 10,000 rows locally: current `dev` produced 10,000 fragments in 4.2 s; this patch with `batch-size = 1000` produced 10 fragments in 0.9 s. Both reads returned 10,000 rows. A checkpoint still flushes the buffer, so a short checkpoint interval can still produce small fragments. That is unchanged. ### Does this PR introduce _any_ user-facing change? Yes. The sink writes one fragment per flush instead of one per row. Existing jobs need no config change. `lance.write.batch-size` defaults to `10000`. ### How was this patch tested? - `LanceSinkWriterBatchTest`: 5 rows with `batch-size = 2` read back as 5 rows in 3 fragments. A per-row `Fragment.create()` fails this test. - `FragmentConverterTest` and `LanceFactoryTest` cover the multi-row batch, the default, and rejected non-positive values. - `./mvnw -pl seatunnel-connectors-v2/connector-lance -am verify` and `seatunnel-ci-tools`. `LanceIT` was not run. ### Check list * [ ] If any new Jar binary package adding in your PR, please add License Notice according [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md) * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs * [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR. * [ ] If you are contributing the connector code, please check that the following files are updated: 1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it 2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml) 3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml) 4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/) 5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
