public class ReadAvro extends AbstractReader
As Avro serializes the schema with the data, it is not necessary to specify a schema when reading it. DataRush will automatically determine the equivalent data types from the Avro schema. The result will be the output type of the reader. However, as Avro and DataRush support different data types, not all data in Avro format can be read; if attempting to read data which cannot be represented in DataRush, an error will be raised.
Primitive Avro types are mapped to DataRush as indicated in the table below.
Avro Type | DataRush Type |
---|---|
BOOLEAN | BOOLEAN |
BYTES | BINARY |
DOUBLE | DOUBLE |
FIXED | BINARY |
FLOAT | FLOAT |
LONG | LONG |
INT | INT |
STRING | STRING |
scalar type
. Nested
records are not currently allowed except for the Avro RECORD representations of
DataRush DATE, TIME, and TIMESTAMP types as described in the WriteAvro
operator.domain
to the enumerated list of symbols.WriteAvro
options, output
Constructor and Description |
---|
ReadAvro()
Reads an empty source with default settings.
|
ReadAvro(ByteSource source)
Reads the specified data source using default
options.
|
ReadAvro(Path path)
Reads the file specified by the path.
|
ReadAvro(String pattern)
Reads all paths matching the specified pattern
using default options.
|
Modifier and Type | Method and Description |
---|---|
protected DataFormat |
computeFormat(CompositionContext ctx)
Determines the data format for the source.
|
AvroMetadata |
discoverMetadata(FileClient client)
Gets the metadata for the currently configured data source.
|
compose, getExtraFieldAction, getFieldErrorAction, getFieldLengthThreshold, getIncludeSourceInfo, getMissingFieldAction, getOutput, getParseOptions, getPessimisticSplitting, getReadBuffer, getReadOnClient, getRecordWarningThreshold, getSelectedFields, getSource, getSplitOptions, getUseMetadata, setExtraFieldAction, setFieldErrorAction, setFieldLengthThreshold, setIncludeSourceInfo, setMissingFieldAction, setParseErrorAction, setParseOptions, setPessimisticSplitting, setReadBuffer, setReadOnClient, setRecordWarningThreshold, setSelectedFields, setSelectedFields, setSource, setSource, setSource, setSplitOptions, setUseMetadata
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableParallelism, getInputPorts, getOutputPorts
public ReadAvro()
AbstractReader.setSource(ByteSource)
public ReadAvro(String pattern)
pattern
- a path-matching patternFileClient.matchPaths(String)
public ReadAvro(Path path)
path
- the path to readpublic ReadAvro(ByteSource source)
source
- the data source to readprotected DataFormat computeFormat(CompositionContext ctx)
AbstractReader
ReadSource
operator. If an
implementation supports schema discovery, it must be
performed in this method.computeFormat
in class AbstractReader
ctx
- the composition context for the current invocation
of AbstractReader.compose(CompositionContext)
public AvroMetadata discoverMetadata(FileClient client)
client
- the file clientCopyright © 2024 Actian Corporation. All rights reserved.