| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/../generated/../../cpp/api/formats.html#cpp-api-json | [Back] [Original] |
Public Members
Whether to check UTF8 validity of string columns.
Optional per-column types (disabling type inference on those columns)
Default type to use for columns not in column_types
If set, this disables type inference on all columns.
Recognized spellings for null values.
Recognized spellings for boolean true values.
Recognized spellings for boolean false values.
Whether string / binary columns can have null values.
If true, then strings in null_values are considered null for string columns. If false, then all strings are valid string values.
Whether quoted values can be null.
If true, then strings in null_values are also considered null when they appear quoted in the CSV file. Otherwise, quoted values are never considered null.
Whether to try to automatically dict-encode string / binary data.
If true, then when type inference detects a string or binary column, it is dict-encoded up to auto_dict_max_cardinality distinct values (per chunk), after which it switches to regular encoding.
This setting is ignored for non-inferred columns (those in column_types).
Decimal point character for floating-point and decimal data.
If non-empty, indicates the names of columns from the CSV file that should be actually read and converted (in the vectors order).
Columns not in this vector will be ignored.
If false, columns in include_columns but not in the CSV file will error out.
If true, columns in include_columns but not in the CSV file will produce a column of nulls (whose type is selected using column_types, or null by default) This option is ignored if include_columns is empty.
User-defined timestamp parsers, using the virtual parser interface in arrow/util/value_parsing.h.
More than one parser can be specified, and the CSV conversion logic will try parsing values starting from the beginning of this vector. If no parsers are specified, we use the default built-in ISO-8601 parser.
Public Static Functions
Create conversion options with default values, including conventional values for null_values, true_values and false_values
Public Members
Whether quoting is used.
Quoting character (if quoting is true)
Whether a quote inside a value is double-quoted.
Whether escaping is used.
Escaping character (if escaping is true)
Whether values are allowed to contain CR (0x0d) and LF (0x0a) characters.
Whether empty lines are ignored.
If false, an empty line represents a single empty value (assuming a one-column CSV file).
A handler function for rows which do not have the correct number of columns.
Public Static Functions
Create parsing options with default values.
Public Members
Whether to use the global CPU thread pool.
Block size we request from the IO layer.
This will determine multi-threading granularity as well as the size of individual record batches. Minimum valid value for block size is 1
Number of header rows to skip (not including the row of column names, if any)
Number of rows to skip after the column names are read, if any.
Column names for the target table.
If empty, fall back on autogenerate_column_names.
Whether to autogenerate column names if column_names is empty.
If true, column names will be of the form f0, f1 If false, column names will be read from the first CSV row after skip_rows.
Public Static Functions
Create read options with default values.
A class that reads an entire CSV file into a Arrow Table.
Public Functions
Public Static Functions
Create a TableReader instance.
A class that reads a CSV file incrementally.
Caveats:
For now, this is always single-threaded (regardless of ReadOptions::use_threads.
Type inference is done on the first block and types are frozen afterwards; to make sure the right data types are inferred, either set ReadOptions::block_size to a large enough value, or use ConvertOptions::column_types to set the desired data types explicitly.
Public Functions
Return the number of bytes which have been read and processed.
The returned number includes CSV bytes which the StreamingReader has finished processing, but not bytes for which some processing (e.g. CSV parsing or conversion to Arrow layout) is still ongoing.
Furthermore, the following rules apply:
bytes skipped by ReadOptions.skip_rows are counted as being read before any records are returned.
bytes read while parsing the header are counted as being read before any records are returned.
bytes skipped by ReadOptions.skip_rows_after_names are counted after the first batch is returned.
Public Static Functions
Create a StreamingReader instance.
This involves some I/O as the first batch must be loaded during the creation process so it is returned as a future
Currently, the StreamingReader is not async-reentrant and does not do any fan-out parsing (see ARROW-11889)
Public Members
Whether to write an initial header line with column names.
Maximum number of rows processed at a time.
The CSV writer converts and writes data in batches of N rows. This number can impact performance.
The string to write for null values. Quotes are not allowed in this string.
IO context for writing.
The end of line character to use for ending rows.
Quoting style.
Quoting style of header.
Note that QuotingStyle::Needed and QuotingStyle::AllValid have the same effect of quoting all column names.
Public Static Functions
Create write options with default values.
Convert table to CSV and write the result to output.
Experimental
Convert batch to CSV and write the result to output.
Experimental
Convert batches read through a RecordBatchReader to CSV and write the results to output.
Experimental
Create a new CSV writer.
User is responsible for closing the actual OutputStream.
sink [in] output stream to write to
schema [in] the schema of the record batches to be written
options [in] options for serialization
Result<std::shared_ptr<RecordBatchWriter>>
Create a new CSV writer.
sink [in] output stream to write to (does not take ownership)
schema [in] the schema of the record batches to be written
options [in] options for serialization
Result<std::shared_ptr<RecordBatchWriter>>
Values:
Unexpected JSON fields are ignored.
Unexpected JSON fields error out.
Unexpected JSON fields are type-inferred and included in the output.
Public Members
Whether to use the global CPU thread pool.
Block size we request from the IO layer; also determines the size of chunks when use_threads is true.
Public Static Functions
Create read options with default values.
Public Members
Optional explicit schema (disables type inference on those fields)
Whether objects may be printed across multiple lines (for example pretty-printed)
If true, parsing may be slower.
How JSON fields outside of explicit_schema (if given) are treated.
Public Static Functions
Create parsing options with default values.
A class that reads an entire JSON file into a Arrow Table.
The file is expected to consist of individual line-separated JSON objects
Public Functions
Public Static Functions
Create a TableReader instance.
A class that reads a JSON file incrementally.
JSON data is read from a stream in fixed-size blocks (configurable with ReadOptions::block_size). Each block is converted to a RecordBatch. Yielded batches have a consistent schema but may differ in row count.
The supplied ParseOptions are used to determine a schema, based either on a provided explicit schema or inferred from the first non-empty block. Afterwards, the target schema is frozen. If UnexpectedFieldBehavior::InferType is specified, unexpected fields will only be inferred for the first block. Afterwards theyll be treated as errors.
If ReadOptions::use_threads is true, each blocks parsing/decoding task will be parallelized on the given cpu_executor (with readahead corresponding to the executors capacity). If an executor isnt provided, the global thread pool will be used.
If ReadOptions::use_threads is false, computations will be run on the calling thread and cpu_executor will be ignored.
Public Functions
Read the next RecordBatch asynchronously This function is async-reentrant (but not synchronously reentrant).
However, if threading is disabled, this will block until completion.
Get the number of bytes which have been successfully converted to record batches and consumed.
Public Static Functions
Create a StreamingReader from an InputStream Blocks until the initial batch is loaded.
stream [in] JSON source stream
read_options [in] Options for reading
parse_options [in] Options for chunking, parsing, and conversion
io_context [in] Context for IO operations (optional)
cpu_executor [in] Executor for computation tasks (optional)
The initialized reader
Create a StreamingReader from an InputStream asynchronously Returned future completes after loading the first batch.
stream [in] JSON source stream
read_options [in] Options for reading
parse_options [in] Options for chunking, parsing, and conversion
io_context [in] Context for IO operations (optional)
cpu_executor [in] Executor for computation tasks (optional)
Future for the initialized reader
Public Functions
Buffered stream reading allows the user to control the memory usage of parquet readers.
This ensure that all RandomAccessFile::ReadAt calls are wrapped in a buffered reader that uses a fix sized buffer (of size buffer_size()) instead of the full size of the ReadAt.
The primary reason for this control knobs is for resource control and not performance.
Enable buffered stream reading.
Disable buffered stream reading.
Return the size of the buffered stream buffer.
Set the size of the buffered stream buffer in bytes.
Return the size limit on thrift strings.
This limit helps prevent space and time bombs in files, but may need to be increased in order to read files with especially large headers.
Set the size limit on thrift strings.
Return the size limit on thrift containers.
This limit helps prevent space and time bombs in files, but may need to be increased in order to read files with especially large headers.
Set the size limit on thrift containers.
Set the decryption properties.
Return the decryption properties.
EXPERIMENTAL: Properties for configuring FileReader behavior.
Public Functions
Set whether to use the IO thread pool to parse columns in parallel.
Default is false.
Return whether will use multiple threads.
Set whether to read a particular column as dictionary encoded.
If the file metadata contains a serialized Arrow schema, then
This is only supported for columns with a Parquet physical type of BYTE_ARRAY, such as string or binary types.
Return whether the column at the index will be read as dictionary.
Set the Arrow binary type to read BYTE_ARRAY columns as.
Allowed values are Type::BINARY, Type::LARGE_BINARY and Type::BINARY_VIEW. Default is Type::BINARY.
If a BYTE_ARRAY column has the STRING logical type, it is read as the Arrow string type corresponding to the configured binary type (for example Type::LARGE_STRING if the configured binary type is Type::LARGE_BINARY).
However, if a serialized Arrow schema is found in the Parquet metadata, this setting is ignored and the Arrow schema takes precedence (see ArrowWriterProperties::store_schema).
Return the Arrow binary type to read BYTE_ARRAY columns as.
Set the Arrow list type to read Parquet list columns as.
Allowed values are Type::LIST and Type::LARGE_LIST. Default is Type::LIST.
However, if a serialized Arrow schema is found in the Parquet metadata, this setting is ignored and the Arrow schema takes precedence (see ArrowWriterProperties::store_schema).
Return the Arrow list type to read Parquet list columns as.
Set the maximum number of rows to read into a record batch.
Will only be fewer rows when there are no more rows in the file. Note that some APIs such as ReadTable may ignore this setting.
Return the batch size in rows.
Note that some APIs such as ReadTable may ignore this setting.
Enable read coalescing (default true).
When enabled, the Arrow reader will pre-buffer necessary regions of the file in-memory. This is intended to improve performance on high-latency filesystems (e.g. Amazon S3).
Return whether read coalescing is enabled.
Set options for read coalescing.
This can be used to tune the implementation for characteristics of different filesystems.
Return the options for read coalescing.
Set execution context for read coalescing.
Return the execution context used for read coalescing.
Set timestamp unit to use for deprecated INT96-encoded timestamps (default is NANO).
Enable Parquet-supported Arrow extension types.
When enabled, Parquet logical types will be mapped to their corresponding Arrow extension types at read time, if such exist. Currently only arrow::extension::json() extension type is supported. Columns whose LogicalType is JSON will be interpreted as arrow::extension::json(), with storage type inferred from the serialized Arrow schema if present, or utf8 by default.
Set whether to load statistics as much as possible.
Default is false.
Return whether loading statistics as much as possible.
Set whether to infer Decimal32/64 from Parquet decimal logical types.
Default is false for compatibility, meaning that only Decimal128 and Decimal256 can be inferred.
Whether to infer Decimal32/64 from Parquet decimal logical types.
When enabled, Parquet decimal columns will be inferred as the smallest possible Arrow Decimal type. When disabled, Parquet decimal columns will be inferred as either Decimal128 or Decimal256, but not Decimal32/64.
Note: if an Arrow schema is found in the Parquet metadata, it will take priority and this setting will be ignored.
Public Functions
Returns the PageIndexReader.
Only one instance is ever created.
If the file does not have the page index, nullptr may be returned. Because it pays to check existence of page index in the file, it is possible to return a non null value even if page index does not exist. It is the callers responsibility to check the return value and follow-up calls to PageIndexReader.
WARNING: The returned PageIndexReader must not outlive the ParquetFileReader. Initialize GetPageIndexReader() is not thread-safety.
Returns the BloomFilterReader.
Only one instance is ever created.
WARNING: The returned BloomFilterReader must not outlive the ParquetFileReader. Initialize GetBloomFilterReader() is not thread-safety.
Pre-buffer the specified column indices in all row groups.
Readers can optionally call this to cache the necessary slices of the file in-memory before deserialization. Arrow readers can automatically do this via an option. This is intended to increase performance when reading from high-latency filesystems (e.g. Amazon S3).
After calling this, creating readers for row groups/column indices that were not buffered may fail. Creating multiple readers for the a subset of the buffered regions is acceptable. This may be called again to buffer a different set of row groups/columns.
If memory usage is a concern, note that data will remain buffered in memory until either PreBuffer() is called again, or the reader itself is destructed. Reading - and buffering - only one row group at a time may be useful.
This method may throw.
Retrieve the list of byte ranges that would need to be read to retrieve the data for the specified row groups and column indices.
A reader can optionally call this if they wish to handle their own caching and management of file reads (or offload them to other readers). Unlike PreBuffer, this method will not perform any actual caching or reads, instead just using the file metadata to determine the byte ranges that would need to be read if you were to consume the entirety of the column chunks for the provided columns in the specified row groups.
If row_groups or column_indices are empty, then the result of this will be empty.
hole_size_limit represents the maximum distance, in bytes, between two consecutive ranges; beyond this value, ranges will not be combined. The default value is 1MB.
range_size_limit is the maximum size in bytes of a combined range; if combining two consecutive ranges would produce a range larger than this, they are not combined. The default values is 64MB. This must be larger than hole_size_limit.
This will not take into account page indexes or any other predicate push down benefits that may be available.
Wait for the specified row groups and column indices to be pre-buffered.
After the returned Future completes, reading the specified row groups/columns will not block.
PreBuffer must be called first. This method does not throw.
Arrow read adapter class for deserializing Parquet files as Arrow row batches.
This interfaces caters for different use cases and thus provides different interfaces. In its most simplistic form, we cater for a user that wants to read the whole Parquet at once with the FileReader::ReadTable method.
More advanced users that also want to implement parallelism on top of each single Parquet files should do this on the RowGroup level. For this, they can call FileReader::RowGroup(i)->ReadTable to receive only the specified RowGroup as a table.
In the most advanced situation, where a consumer wants to independently read RowGroups in parallel and consume each column individually, they can call FileReader::RowGroup(i)->Column(j)->Read and receive an arrow::Column instance.
Finally, one can also get a stream of record batches using FileReader::GetRecordBatchReader(). This can internally decode columns in parallel if use_threads was enabled in the ArrowReaderProperties.
The parquet format supports an optional integer field_id which can be assigned to a field. Arrow will convert these field IDs to a metadata key named PARQUET:field_id on the appropriate field.
Public Functions
Factory function to create a FileReader from a ParquetFileReader and properties.
Factory function to create a FileReader from a ParquetFileReader.
Return arrow schema for all the columns.
Read column as a whole into a chunked array.
The index i refers the index of the top level schema field, which may be nested or flat - e.g.
0 foo.bar foo.bar.baz foo.qux 1 foo2 2 foo3
i=0 will read the entire foo struct, i=1 the foo2 primitive column etc
Return a RecordBatchReader of all row groups and columns.
Return a RecordBatchReader of row groups selected from row_group_indices.
Note that the ordering in row_group_indices matters. FileReaders must outlive their RecordBatchReaders.
error Result if row_group_indices contains an invalid index
Return a RecordBatchReader of row groups selected from row_group_indices, whose columns are selected by column_indices.
Note that the ordering in row_group_indices and column_indices matter. FileReaders must outlive their RecordBatchReaders.
error Result if either row_group_indices or column_indices contains an invalid index
Return a RecordBatchReader of row groups selected from row_group_indices, whose columns are selected by column_indices.
Note that the ordering in row_group_indices and column_indices matter. FileReaders must outlive their RecordBatchReaders.
Deprecated in 21.0.0. Use arrow::Result version instead.
row_group_indices which row groups to read (order determines read order).
column_indices which columns to read (order determines output schema).
out [out] record batch stream from parquet data.
error Status if either row_group_indices or column_indices contains an invalid index
Deprecated in 21.0.0. Use arrow::Result version instead.
Deprecated in 21.0.0. Use arrow::Result version instead.
Return a generator of record batches.
The FileReader must outlive the generator, so this requires that you pass in a shared_ptr.
error Result if either row_group_indices or column_indices contains an invalid index
Read all columns into a Table.
Deprecated in 24.0.0. Use arrow::Result version instead.
Read the given columns into a Table.
The indicated column indices are relative to the internal representation of the parquet table. For instance : 0 foo.bar foo.bar.baz 0 foo.bar.baz2 1 foo.qux 2 1 foo2 3 2 foo3 4
i=0 will read foo.bar.baz, i=1 will read only foo.bar.baz2 and so on. Only leaf fields have indices; foo itself doesnt have an index. To get the index for a particular leaf field, one can use manifest().schema_fields to get the top level fields, and then walk the tree to identify the relevant leaf fields and access its column_index. To get the total number of leaf fields, use FileMetadata.num_columns().
Deprecated in 24.0.0. Use arrow::Result version instead.
Read the given row group columns into a Table.
Read the given row group into a Table.
Read the given row groups columns into a Table.
Read the given row groups into a Table.
Deprecated in 24.0.0. Use arrow::Result version instead.
Deprecated in 24.0.0. Use arrow::Result version instead.
Deprecated in 24.0.0. Use arrow::Result version instead.
Deprecated in 24.0.0. Use arrow::Result version instead.
Scan file contents with one thread, return number of rows.
Return a reader for the RowGroup, this object must not outlive the FileReader.
The number of row groups in the file.
Set whether to use multiple threads during reads of multiple columns.
By default only one thread is used.
Set number of records to read per batch for the RecordBatchReader.
Public Static Functions
Factory function to create a FileReader from a ParquetFileReader and properties.
Deprecated in 23.0.0. Use arrow::Result version instead.
Factory function to create a FileReader from a ParquetFileReader.
Deprecated in 23.0.0. Use arrow::Result version instead.
Experimental helper class for bindings (like Python) that struggle either with std::move or C++ exceptions.
Public Functions
Create FileReaderBuilder from Arrow file and optional properties / metadata.
Create FileReaderBuilder from file path and optional properties / metadata.
Set Arrow MemoryPool for memory allocation.
Set Arrow reader properties.
Build FileReader instance.
Build FileReader from Arrow file and MemoryPool.
Advanced settings are supported through the FileReaderBuilder class.
A class for reading Parquet files using an output stream type API.
The values given must be of the correct type i.e. the type must match the file schema exactly otherwise a ParquetException will be thrown.
The user must explicitly advance to the next row using the EndRow() function or EndRow input manipulator.
Required and optional fields are supported:
Required fields are read using operator>>(T)
Optional fields are read with operator>>(std::optional<T>)
Note that operator>>(std::optional<T>) can be used to read required fields.
Similarly operator>>(T) can be used to read optional fields. However, if the value is not present then a ParquetException will be raised.
Currently there is no support for repeated fields.
Public Functions
Reader must have at least one field defined in its schema.
Terminate current row and advance to next one.
ParquetException if all columns in the row were not read or skipped.
Skip the data in the next columns.
If the number of columns exceeds the columns remaining on the current row then skipping is terminated - it does not continue skipping columns on the next row. Skipping of columns still requires the use EndRow even if all remaining columns were skipped.
Number of columns actually skipped.
Skip the data in the next rows.
Skipping of rows is not allowed if reading of data for the current row is not finished. Skipping of rows will be terminated if the end of file is reached.
Number of rows actually skipped.
Public Functions
EXPERIMENTAL: Use content-defined page chunking for all columns.
Optimize parquet files for content addressable storage (CAS) systems by writing data pages according to content-defined chunk boundaries. This allows for more efficient deduplication of data across files, hence more efficient network transfers and storage. The chunking is based on a rolling hash algorithm that identifies chunk boundaries based on the actual content of the data.
Note that only the WriteArrow() interface is supported at the moment.
EXPERIMENTAL: Disable content-defined page chunking for all columns.
EXPERIMENTAL: Specify content-defined chunking options, see CdcOptions.
Specify the memory pool for the writer. Default default_memory_pool.
Enable dictionary encoding in general for all columns.
Default enabled.
Disable dictionary encoding in general for all columns.
Default enabled.
Enable dictionary encoding for column specified by path.
Default enabled.
Enable dictionary encoding for column specified by path.
Default enabled.
Disable dictionary encoding for column specified by path.
Default enabled.
Disable dictionary encoding for column specified by path.
Default enabled.
Specify the dictionary page size limit per row group. Default 1MB.
Specify the write batch size while writing batches of Arrow values into Parquet.
Default 1024.
Specify the max number of rows to put in a single row group.
Default 1Mi rows.
Specify the maximum number of rows per data page.
Default 20K rows.
Specify the data page version.
Default V1.
Specify the Parquet file version.
Default PARQUET_2_6.
Define the encoding that is used when we dont utilise dictionary encoding.
This is only applied if dictionary encoding is disabled. If the dictionary grows too large we always fall back to the PLAIN encoding.
Define the encoding that is used when we dont utilise dictionary encoding.
This is only applied if dictionary encoding is disabled. If the dictionary grows too large we always fall back to the PLAIN encoding.
Define the encoding that is used when we dont utilise dictionary encoding.
This is only applied if dictionary encoding is disabled. If the dictionary grows too large we always fall back to the PLAIN encoding.
Specify compression codec in general for all columns.
Default UNCOMPRESSED.
Specify max statistics size to store min max value.
Default 4KB.
Specify compression codec for the column specified by path.
Default UNCOMPRESSED.
Specify compression codec for the column specified by path.
Default UNCOMPRESSED.
Specify the default compression level for the compressor in every column.
In case a column does not have an explicitly specified compression level, the default one would be used.
The provided compression level is compressor specific. The user would have to familiarize oneself with the available levels for the selected compressor. If the compressor does not allow for selecting different compression levels, calling this function would not have any effect. Parquet and Arrow do not validate the passed compression level. If no level is selected by the user or if the special std::numeric_limits<int>::min() value is passed, then Arrow selects the compression level.
If other compressor-specific options need to be set in addition to the compression level, use the codec_options method.
Specify a compression level for the compressor for the column described by path.
The provided compression level is compressor specific. The user would have to familiarize oneself with the available levels for the selected compressor. If the compressor does not allow for selecting different compression levels, calling this function would not have any effect. Parquet and Arrow do not validate the passed compression level. If no level is selected by the user or if the special std::numeric_limits<int>::min() value is passed, then Arrow selects the compression level.
Specify a compression level for the compressor for the column described by path.
The provided compression level is compressor specific. The user would have to familiarize oneself with the available levels for the selected compressor. If the compressor does not allow for selecting different compression levels, calling this function would not have any effect. Parquet and Arrow do not validate the passed compression level. If no level is selected by the user or if the special std::numeric_limits<int>::min() value is passed, then Arrow selects the compression level.
Specify the default codec options for the compressor in every column.
The codec options allow configuring the compression level as well as other codec-specific options.
Specify the codec options for the compressor for the column described by path.
Specify the codec options for the compressor for the column described by path.
Define the file encryption properties.
Default NULL.
Enable statistics for the column specified by path.
Default enabled.
Enable statistics for the column specified by path.
Default enabled.
Define the sorting columns.
Default empty.
If sorting columns are set, user should ensure that records are sorted by sorting columns. Otherwise, the storing data will be inconsistent with sorting_columns metadata.
Disable statistics for the column specified by path.
Default enabled.
Disable statistics for the column specified by path.
Default enabled.
Disable bloom filter for the column specified by path.
Default disabled.
Disable bloom filter for the column specified by path.
Default disabled.
Enable bloom filter for the column specified by path.
Default disabled.
Note
Bloom filter is not supported for boolean columns. ParquetException will be thrown during write if the column is of boolean type.
Enable bloom filter for the column specified by path.
Default disabled.
Note
Bloom filter is not supported for boolean columns. ParquetException will be thrown during write if the column is of boolean type.
Allow decimals with 1 <= precision <= 18 to be stored as integers.
In Parquet, DECIMAL can be stored in any of the following physical types:
int32: for 1 <= precision <= 9.
int64: for 10 <= precision <= 18.
fixed_len_byte_array: precision is limited by the array size. Length n can store <= floor(log_10(2^(8*n - 1) - 1)) base-10 digits.
binary: precision is unlimited. The minimum number of bytes to store the unscaled value is used.
By default, this is DISABLED and all decimal types annotate fixed_len_byte_array.
When enabled, the C++ writer will use following physical types to store decimals:
int32: for 1 <= precision <= 9.
int64: for 10 <= precision <= 18.
fixed_len_byte_array: for precision > 18.
As a consequence, decimal columns stored in integer types are more compact.
Disable decimal logical type with 1 <= precision <= 18 to be stored as integer physical type.
Default disabled.
Enable writing page index in general for all columns.
Default enabled.
Writing statistics to the page index disables the old method of writing statistics to each data page header. The page index makes filtering more efficient than the page header, as it gathers all the statistics for a Parquet file in a single place, avoiding scattered I/O.
Please check the link below for more details: apache/parquet-format
Disable writing page index in general for all columns. Default enabled.
Enable writing page index for column specified by path. Default enabled.
Enable writing page index for column specified by path. Default enabled.
Disable writing page index for column specified by path. Default enabled.
Disable writing page index for column specified by path. Default enabled.
Set the level to write size statistics for all columns.
Default is PageAndColumnChunk.
level The level to write size statistics. Note that if page index is not enabled, page level size statistics will not be written even if the level is set to PageAndColumnChunk.
Build the WriterProperties with the builder parameters.
The WriterProperties defined by the builder.
Public Functions
Enable nested type naming according to the parquet specification.
Older versions of arrow wrote out field names for nested lists based on the name of the field. According to the parquet specification they should always be element.
The underlying engine version to use when writing Arrow data.
V2 is currently the latest V1 is considered deprecated but left in place in case there are bugs detected in V2.
Returns whether the writer will use multiple threads to write columns in parallel in the buffered row group mode.
Returns the executor used to write columns in parallel.
The value of isAdjustedTOUTC when writing a TIME column.
Note this setting doesnt affect TIMESTAMP data.
Public Functions
Disable writing legacy int96 timestamps (default disabled).
Enable writing legacy int96 timestamps (default disabled).
May be turned on to write timestamps compatible with older Parquet writers. This takes precedent over coerce_timestamps.
Coerce all timestamps to the specified time unit.
unit time unit to truncate to. For Parquet versions 1.0 and 2.4, nanoseconds are casted to microseconds.
Allow loss of data when truncating timestamps.
This is disallowed by default and an error will be returned.
Disallow loss of data when truncating timestamps (default).
EXPERIMENTAL: Write binary serialized Arrow schema to the file, to enable certain read options (like read_dictionary) to be set automatically or read back non-default Arrow types like ListView, LargeListView, LargeList, and Arrow extension types.
When enabled, will not preserve Arrow field names for list types.
Instead of using the field names Arrow uses for the values array of list types (default item), will use element, as is specified in the Parquet spec.
This is enabled by default.
Set the version of the Parquet writer engine.
Set whether to use multiple threads to write columns in parallel in the buffered row group mode.
WARNING: If writing multiple files in parallel in the same executor, deadlock may occur if use_threads is true. Please disable it in this case.
Default is false.
Set the executor to write columns in parallel in the buffered row group mode.
Default is nullptr and the default cpu executor will be used.
Set the value of isAdjustedTOUTC when writing a TIME column.
Default is false because Arrow TIME data is expressed in an unspecified timezone. Note this setting doesnt affect TIMESTAMP data.
Create the final properties.
Iterative FileWriter class.
For basic usage, can write a Table at a time, creating one or more row groups per write call.
For advanced usage, can write column-by-column: Start a new RowGroup or Chunk with NewRowGroup, then write column-by-column the whole column chunk.
If PARQUET:field_id is present as a metadata key on a field, and the corresponding value is a nonnegative integer, then it will be used as the field_id in the parquet file.
Public Functions
Try to create an Arrow to Parquet file writer.
11.0.0
schema schema of data that will be passed.
pool memory pool to use.
sink output stream to write Parquet data.
properties general Parquet writer properties.
arrow_properties Arrow-specific writer properties.
Return the Arrow schema to be written to.
Write a Table to Parquet.
table Arrow table to write.
chunk_size maximum number of rows to write per row group.
Start a new row group.
Returns an error if not all columns have been written.
Write ColumnChunk in row group using an array.
Write ColumnChunk in row group using slice of a ChunkedArray.
Write ColumnChunk in a row group using a ChunkedArray.
Start a new buffered row group.
Returns an error if not all columns have been written.
Write a RecordBatch into the buffered row group.
Multiple RecordBatches can be written into the same row group through this method.
WriterProperties.max_row_group_length() is respected and a new row group will be created if the current row group exceeds the limit.
Batches get flushed to the output stream once NewBufferedRowGroup() or Close() is called.
WARNING: If you are writing multiple files in parallel in the same executor, deadlock may occur if ArrowWriterProperties::use_threads is set to true to write columns in parallel. Please disable use_threads option in this case.
Add key-value metadata to the file.
WARNING: If store_schema is enabled, ARROW:schema would be stored in the key-value metadata. Overwriting this key would result in store_schema being unusable during read.
Note
This will overwrite any existing metadata with the same key.
key_value_metadata [in] the metadata to add.
Error if Close() has been called.
Write a Table to Parquet.
This writes one table in a single shot. To write a Parquet file with multiple tables iteratively, see parquet::arrow::FileWriter.
table Table to write.
pool memory pool to use.
sink output stream to write Parquet data.
chunk_size maximum number of rows to write per row group.
properties general Parquet writer properties.
arrow_properties Arrow-specific writer properties.
A class for writing Parquet files using an output stream type API.
The values given must be of the correct type i.e. the type must match the file schema exactly otherwise a ParquetException will be thrown.
The user must explicitly indicate the end of the row using the EndRow() function or EndRow output manipulator.
A maximum row group size can be configured, the default size is 512MB. Alternatively the row group size can be set to zero and the user can create new row groups by calling the EndRowGroup() function or using the EndRowGroup output manipulator.
Required and optional fields are supported:
Required fields are written using operator<<(T)
Optional fields are written using operator<<(std::optional<T>).
Note that operator<<(T) can be used to write optional fields.
Similarly, operator<<(std::optional<T>) can be used to write required fields. However if the optional parameter does not have a value (i.e. it is nullopt) then a ParquetException will be raised.
Currently there is no support for repeated fields.
Public Types
Helper class to write variable length raw data.
Public Functions
Output operators for required fields.
These can also be used for optional fields when a value must be set.
Output operators for fixed length strings.
Output operators for variable length strings.
Output operators for variable length raw data.
Output operator for optional fields.
Skip the next N columns of optional data.
If there are less than N columns remaining then the excess columns are ignored.
ParquetException if there is an attempt to skip any required column.
Number of columns actually skipped.
Terminate the current row and advance to next one.
ParquetException if all columns in the row were not written or skipped.
Terminate the current row group and create new one.
Helper class to write fixed length strings.
This is useful as the standard string view (such as std::string_view) is for variable length data.
Read an Arrow Table or RecordBatch from an ORC file.
Public Functions
Return the schema read from the ORC file.
the returned Schema object
Read the file as a Table.
The table will be composed of one record batch per stripe.
the returned Table
Read the file as a Table.
The table will be composed of one record batch per stripe.
Read the file as a Table.
The table will be composed of one record batch per stripe.
include_indices [in] the selected field indices to read
the returned Table
Read the file as a Table.
The table will be composed of one record batch per stripe.
include_names [in] the selected field names to read
the returned Table
Read the file as a Table.
The table will be composed of one record batch per stripe.
Read a single stripe as a RecordBatch.
stripe [in] the stripe index
the returned RecordBatch
Read a single stripe as a RecordBatch.
stripe [in] the stripe index
include_indices [in] the selected field indices to read
the returned RecordBatch
Read a single stripe as a RecordBatch.
stripe [in] the stripe index
include_names [in] the selected field names to read
the returned RecordBatch
Seek to designated row.
Invoke NextStripeReader() after seek will return stripe reader starting from designated row.
row_number [in] the rows number to seek
Get a stripe level record batch iterator.
Each record batch will have up to batch_size rows. NextStripeReader serves as a fine-grained alternative to ReadStripe which may cause OOM issues by loading the whole stripe into memory.
Note this will only read rows for the current stripe, not the entire file.
batch_size [in] the maximum number of rows in each record batch
the returned stripe reader
Get a stripe level record batch iterator.
Each record batch will have up to batch_size rows. NextStripeReader serves as a fine-grained alternative to ReadStripe which may cause OOM issues by loading the whole stripe into memory.
Note this will only read rows for the current stripe, not the entire file.
batch_size [in] the maximum number of rows in each record batch
include_indices [in] the selected field indices to read
the stripe reader
Get a record batch iterator for the entire file.
Each record batch will have up to batch_size rows.
batch_size [in] the maximum number of rows in each record batch
include_names [in] the selected field names to read, if not empty (otherwise all fields are read)
the record batch iterator
The number of stripes in the file.
The number of rows in the file.
StripeInformation for each stripe.
Get the format version of the file.
Currently known values are 0.11 and 0.12.
The FileVersion of the ORC file.
Get the software instance and version that wrote this file.
a user-facing string that specifies the software version
Get the compression kind of the file.
The kind of compression in the ORC file.
Get the buffer size for the compression.
Number of bytes to buffer for the compression codec.
Get the number of rows per an entry in the row index.
the number of rows per an entry in the row index or 0 if there is no row index.
Get ID of writer that generated the file.
UNKNOWN_WRITER if the writer ID is undefined
Get the writer id value when getWriterId() returns an unknown writer.
the integer value of the writer ID.
Get the version of the writer.
the version of the writer.
Get the number of stripe statistics in the file.
the number of stripe statistics
Get the length of the data stripes in the file.
return the number of bytes in stripes
Get the length of the file stripe statistics.
the number of compressed bytes in the file stripe statistics
Get the length of the file footer.
the number of compressed bytes in the file footer
Get the length of the file postscript.
the number of bytes in the file postscript
Get the total length of the file.
the number of bytes in the file
Get the serialized file tail.
Useful if another reader of the same file wants to avoid re-reading the file tail. See ReadOptions.SetSerializedFileTail().
a string of bytes with the file tail
Return the metadata read from the ORC file.
A KeyValueMetadata object containing the ORC metadata
Public Static Functions
Creates a new ORC reader.
file [in] the data source
pool [in] a MemoryPool to use for buffer allocations
the returned reader object
Options for the ORC Writer.
Public Members
Number of rows the ORC writer writes at a time, default 1024.
Which ORC file version to use, default FileVersion(0, 12)
Size of each ORC stripe in bytes, default 64 MiB.
The compression codec of the ORC file, there is no compression by default.
The size of each compression block in bytes, default 64 KiB.
The compression strategy i.e.
speed vs size reduction, default CompressionStrategy::kSpeed
The number of rows per an entry in the row index, default 10000.
The padding tolerance, default 0.0.
The dictionary key size threshold.
0 to disable dictionary encoding. 1 to always enable dictionary encoding, default 0.0
The array of columns that use the bloom filter, default empty.
The upper limit of the false-positive rate of the bloom filter, default 0.05.
Write an Arrow Table or RecordBatch to an ORC file.
Public Functions
Write a table.
This can be called multiple times.
Tables passed in subsequent calls must match the schema of the table that was written first.
table [in] the Arrow table from which data is extracted.
Write a RecordBatch.
This can be called multiple times.
RecordBatches passed in subsequent calls must match the schema of the RecordBatch that was written first.
record_batch [in] the Arrow RecordBatch from which data is extracted.
Public Static Functions
Creates a new ORC writer.
output_stream [in] a pointer to the io::OutputStream to write into
write_options [in] the ORC writer options for Arrow
the returned writer object
| Web Proxy Viewer | New URL | Original Page |