@@ -33,22 +33,22 @@ instance, and then converts it back to the original array of structs.
3333Dynamic Schemas
3434---------------
3535
36- In many cases, we need to convert to and from row data that does not have a
36+ In many cases, we need to convert to and from row data that does not have a
3737schema known at compile time. To help implement these conversions, this library
3838provides several utilities:
3939
40- * :class: `arrow::RecordBatchBuilder `: creates and manages array builders for
40+ * :class: `arrow::RecordBatchBuilder `: creates and manages array builders for
4141 a full record batch.
4242* :func: `arrow::VisitTypeInline `: dispatch to functions specialized for the given
4343 array type.
4444* :ref: `type-traits ` (such as ``arrow::enable_if_primitive_ctype ``): narrow template
45- functions to specific Arrow types, useful in conjunction with
45+ functions to specific Arrow types, useful in conjunction with
4646 the :ref: `cpp-visitor-pattern `.
4747* :class: `arrow::TableBatchReader `: read a table in a batch at a time, with each
4848 batch being a zero-copy slice.
4949
5050The following example shows how to implement conversion between ``rapidjson::Document ``
51- and Arrow objects. You can read the full code example at
51+ and Arrow objects. You can read the full code example at
5252https://github.com/apache/arrow/blob/master/cpp/examples/arrow/rapidjson_row_converter.cc
5353
5454Writing conversions to Arrow
@@ -58,35 +58,35 @@ To convert rows to Arrow record batches, we'll setup Array builders for all the
5858and then for each field iterate through row values and append to the builders.
5959We assume that we already know the target schema, which may have
6060been provided by another system or was inferred in another function. Inferring
61- the schema *during * conversion is a challenging proposition; many systems will
61+ the schema *during * conversion is a challenging proposition; many systems will
6262check the first N rows to infer a schema if there is none already available.
6363
6464At the top level, we define a function ``ConvertToRecordBatch ``:
6565
6666.. literalinclude :: ../../../../cpp/examples/arrow/rapidjson_row_converter.cc
6767 :language: cpp
6868 :start-at: arrow::Result<std::shared_ptr<arrow::RecordBatch>> ConvertToRecordBatch(
69- :end-at: } // ConvertToRecordBatch
69+ :end-at: } // ConvertToRecordBatch
7070 :linenos:
7171 :lineno-match:
7272
7373First we use :class: `arrow::RecordBatchBuilder `, which conveniently creates builders
7474for each field in the schema. Then we iterate over the fields of the schema, get
7575the builder, and call ``Convert() `` on our ``JsonValueConverter `` (to be discussed
76- next). At the end, we call ``batch->ValidateFull() ``, which checks the integrity
76+ next). At the end, we call ``batch->ValidateFull() ``, which checks the integrity
7777of our arrays to make sure the conversion was performed correctly, which is useful
78- for debugging new conversion implementations.
78+ for debugging new conversion implementations.
7979
8080One level down, the ``JsonValueConverter `` is responsible for appending row values
8181for the provided field to a provided array builder. In order to specialize logic
8282for each data type, it implements ``Visit `` methods and calls :func: `arrow::VisitTypeInline `.
8383(See more about type visitors in :ref: `cpp-visitor-pattern `.)
8484
8585At the end of that class is the private method ``FieldValues() ``, which returns
86- an iterator of the column values for the current field across the rows. In
87- row-based structures that are flat (such as a vector of values) this may be
86+ an iterator of the column values for the current field across the rows. In
87+ row-based structures that are flat (such as a vector of values) this may be
8888trivial to implement. But if the schema is nested, as in the case of JSON documents,
89- a special iterator is needed to navigate the levels of nesting. See the
89+ a special iterator is needed to navigate the levels of nesting. See the
9090`full example <https://github.com/apache/arrow/blob/master/cpp/examples/arrow/rapidjson_row_converter.cc >`_
9191for the implementation details of ``DocValuesIterator ``.
9292
@@ -100,7 +100,7 @@ for the implementation details of ``DocValuesIterator``.
100100Writing conversions from Arrow
101101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102102
103- To convert into rows *from * Arrow record batches, we'll process the table in
103+ To convert into rows *from * Arrow record batches, we'll process the table in
104104smaller batches, visiting each field of the batch and filling the output rows
105105column-by-column.
106106
@@ -109,7 +109,7 @@ for converting Arrow batches and tables to rows. In many cases, it's more optima
109109to perform conversions to rows in smaller batches, rather than doing the entire
110110table at once. So we define one ``ConvertToVector `` method to convert a single
111111batch, then in the other conversion method we use :class: `arrow::TableBatchReader `
112- to iterate over slices of a table. This returns Arrow's iterator type
112+ to iterate over slices of a table. This returns Arrow's iterator type
113113(:class: `arrow::Iterator `) so rows could then be processed either one-at-a-time
114114or be collected into a container.
115115
0 commit comments