Class OrcDataWriter
Writes records to Apache ORC columnar files.
See Apache ORC columnar storage.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
ConstructorsConstructorDescriptionOrcDataWriter(File file) Write ORC data to a file.OrcDataWriter(Path path) Write ORC data to a path like S3, Hadoop etc. -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this endpoint's current state to aDataException.voidclose()Indicates that this endpoint has finished reading or writing.intIndicates the maximum number of records to buffer when writing ORC data (default 1024).intReturns default precision value for BigDecimal type of values.intIndicates the scale used when writing BigDecimal values (default 10).CompressionKindIndicates the compression used for writing (default NONE).ConfigurationReturns the Orc configuration parameters.PathgetPath()Returns thePathof the ORC file being written.Indicates the rounding algorithm used for all BigDecimal values (default isRoundingMode.HALF_UP).RowBatchVersionReturnsRowBatchVersionto store ORC data.TypeDescriptionIndicates the schema used to write the file.booleanOverwrites the file if true, otherwise, throws an exception if the file already exists.booleanIndicates ifInstants should be used to store datetime values.booleanisUTC()Indicates if datetime values are adjusted to UTC.booleanIndicates whether UUID values are written as strings or bytes.voidopen()Makes this endpoint ready for reading or writing.setBatchSize(int batchSize) Indicates the maximum number of records to buffer when writing ORC data (default 1024).setBigDecimalPrecision(int bigDecimalPrecision) Sets default precision value for BigDecimal type of values.setBigDecimalScale(int bigDecimalScale) Indicates the scale used when writing BigDecimal values (default 10).setCompressionKind(CompressionKind compressionKind) Indicates the compression used for writing (default NONE).setConfig(Configuration config) Sets the Orc configuration parameters.setOverwrite(boolean overwrite) Overwrites the file if true, otherwise, throws an exception if the file already exists.setRoundingMode(RoundingMode roundingMode) Indicates the rounding algorithm used for all BigDecimal values (default isRoundingMode.HALF_UP).setRowBatchVersion(RowBatchVersion rowBatchVersion) SetsRowBatchVersionto store ORC data.setSchema(TypeDescription schema) Indicates the schema used to write the file.setUseTimestampInstant(boolean useTimestampInstant) Indicates ifInstants should be used to store datetime values.setUTC(boolean isUTC) Indicates if datetime values are adjusted to UTC.setWriteUuidAsString(boolean writeUuidAsString) Indicates whether UUID values are written as strings or bytes.protected voidOverridden by subclasses to write the specified record to thisDataWriter.Methods inherited from class com.northconcepts.datapipeline.core.DataWriter
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriter, writeMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
-
Constructor Details
-
OrcDataWriter
Write ORC data to a file. -
OrcDataWriter
public OrcDataWriter(Path path) Write ORC data to a path like S3, Hadoop etc.
-
-
Method Details
-
writeImpl
Description copied from class:DataWriterOverridden by subclasses to write the specified record to thisDataWriter.Contract for subclasses (see also
docs/authoring/DataWriter.md):- Do not call this method directly —
DataWriter.write(Record)is the template method that wraps exceptions, increments the record count, and attaches the offending record to thrownDataExceptions. - Do not call
DataEndpoint.incrementRecordCount()here;DataWriter.write(Record)already does. - Throw raw exceptions;
DataWriter.write(Record)wraps them viaexception(throwable).setRecord(record).
- Specified by:
writeImplin classDataWriter- Throws:
Throwable
- Do not call this method directly —
-
open
Description copied from class:DataEndpointMakes this endpoint ready for reading or writing.- Overrides:
openin classIntegrationWriter- Throws:
DataException
-
close
Description copied from class:DataEndpointIndicates that this endpoint has finished reading or writing.- Overrides:
closein classDataEndpoint- Throws:
DataException
-
getSchema
public TypeDescription getSchema()Indicates the schema used to write the file. -
setSchema
Indicates the schema used to write the file. -
getConfig
public Configuration getConfig()Returns the Orc configuration parameters. -
setConfig
Sets the Orc configuration parameters. -
getBatchSize
public int getBatchSize()Indicates the maximum number of records to buffer when writing ORC data (default 1024). -
setBatchSize
Indicates the maximum number of records to buffer when writing ORC data (default 1024). -
isUseTimestampInstant
public boolean isUseTimestampInstant()Indicates ifInstants should be used to store datetime values. -
setUseTimestampInstant
Indicates ifInstants should be used to store datetime values. -
isOverwrite
public boolean isOverwrite()Overwrites the file if true, otherwise, throws an exception if the file already exists. -
setOverwrite
Overwrites the file if true, otherwise, throws an exception if the file already exists. -
addExceptionProperties
Description copied from class:EndpointAdds this endpoint's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Overrides:
addExceptionPropertiesin classDataWriter
-
isUTC
public boolean isUTC()Indicates if datetime values are adjusted to UTC. -
setUTC
Indicates if datetime values are adjusted to UTC. -
isWriteUuidAsString
public boolean isWriteUuidAsString()Indicates whether UUID values are written as strings or bytes. If set to false, UUID values will be written as bytes.
Default value is true.
-
setWriteUuidAsString
Indicates whether UUID values are written as strings or bytes. If set to false, UUID values will be written as bytes.
Default value is true.
-
getRowBatchVersion
public RowBatchVersion getRowBatchVersion()ReturnsRowBatchVersionto store ORC data. precision > TypeDescription.MAX_DECIMAL64_PRECISION (18) then DecimalColumnVector is used instead of Decimal64ColumnVector. -
setRowBatchVersion
SetsRowBatchVersionto store ORC data. If BigDecimal value has precision > TypeDescription.MAX_DECIMAL64_PRECISION (18) then DecimalColumnVector is used instead of Decimal64ColumnVector. -
getBigDecimalPrecision
public int getBigDecimalPrecision()Returns default precision value for BigDecimal type of values. Default value is HiveDecimal.MAX_PRECISION (38). -
setBigDecimalPrecision
Sets default precision value for BigDecimal type of values. Default value is HiveDecimal.MAX_PRECISION (38). -
getBigDecimalScale
public int getBigDecimalScale()Indicates the scale used when writing BigDecimal values (default 10). -
setBigDecimalScale
Indicates the scale used when writing BigDecimal values (default 10). -
getRoundingMode
Indicates the rounding algorithm used for all BigDecimal values (default isRoundingMode.HALF_UP). -
setRoundingMode
Indicates the rounding algorithm used for all BigDecimal values (default isRoundingMode.HALF_UP). -
getCompressionKind
public CompressionKind getCompressionKind()Indicates the compression used for writing (default NONE). -
setCompressionKind
Indicates the compression used for writing (default NONE). -
getPath
public Path getPath()Returns thePathof the ORC file being written.
-