11- Start Date: 2026-03-13
22- Authors: Mikhail Kot
33
4- # C Scan API
4+ # High level C Scan API
55## Summary
66
77Provide a layered C Scan API for non-Rust clients[ ^ 1 ] , each layer exposing more
@@ -72,7 +72,10 @@ requires sync hosts to manage their own event loop which is tedious.
7272Another benefit of splitting API into layers is that it can be discussed and
7373implemented separately.
7474
75- ## High level API
75+ As this is a big change, this PR will from now on focus just on the high level
76+ scan API. Other levels may be implemented later on demand.
77+
78+ ## Overview
7679
7780```
7881┌──────────┐
@@ -91,7 +94,7 @@ implemented separately.
9194 └─►Array (thread unsafe)
9295```
9396
94- ### DataSource
97+ ## DataSource
9598
9699A DataSource is a reference to multiple possibly remote files. When created, it
97100opens first file to determine the schema from DType, all other operations are
@@ -187,7 +190,7 @@ to a query engine.
187190 Memory allocation customization is out of scope of this proposal, but it's
188191 possible for Vortex to expose bringing allocator from outside for buffers.
189192
190- ### Scan
193+ ## Scan
191194
192195A Scan is a one-time traversal of files in a DataSource. A Scan can't be
193196restarted once requested. Hosts are encouraged to utilize multiple threads for
@@ -262,7 +265,7 @@ vx_data_source_scan(const vx_data_source *ds, const vx_scan_options *options,
262265 vx_estimate* estimate, vx_error ** err);
263266```
264267
265- ### Partition
268+ ## Partition
266269
267270A Partition allows a worker thread to produce Arrays thread-unsafely.
268271Partitions also allow exporting the data to ArrowArrayStream for hosts
@@ -291,35 +294,19 @@ void vx_partition_scan_arrow(const vx_partition *partition,
291294const vx_array *vx_partition_next(vx_partition *partition, vx_error **err);
292295```
293296
294- ### Array introspection
297+ ## Array introspection
295298
296299The main question is how to transform outputs of iteration, ` vx_array ` , into
297300something query engines can operate with. You need to execute the array
298301iteratively till you recognize data and start exporting it. Thus API provides a
299302way to scan partitions directly into ArrowArrayStream which should be good
300303enough for most hosts.
301304
302- ## Middle level
303-
304- TODO
305-
306- ## Low level
307-
308- TODO
309-
310305## Compatibility
311306
312307No impact. Existing C Scan API will exist for some time but will be removed
313308eventually.
314309
315- ## Drawbacks
316-
317- TODO
318-
319- ## Alternatives
320-
321- TODO
322-
323310## Prior Art
324311
325312- Dividing scan requests into Partitions for threads is taken from DataFusion's
0 commit comments