vertica-stream-writer

A pom for deploying to maven central.

License

License

GroupId

GroupId

com.github.jcustenborder
ArtifactId

ArtifactId

vertica-stream-writer
Last Version

Last Version

0.0.1.15
Release Date

Release Date

Type

Type

jar
Description

Description

vertica-stream-writer
A pom for deploying to maven central.
Project URL

Project URL

https://github.com/jcustenborder/vertica-stream-writer
Source Code Management

Source Code Management

https://github.com/jcustenborder/vertica-stream-writer

Download vertica-stream-writer

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.jcustenborder/vertica-stream-writer/ -->
<dependency>
    <groupId>com.github.jcustenborder</groupId>
    <artifactId>vertica-stream-writer</artifactId>
    <version>0.0.1.15</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.jcustenborder/vertica-stream-writer/
implementation 'com.github.jcustenborder:vertica-stream-writer:0.0.1.15'
// https://jarcasting.com/artifacts/com.github.jcustenborder/vertica-stream-writer/
implementation ("com.github.jcustenborder:vertica-stream-writer:0.0.1.15")
'com.github.jcustenborder:vertica-stream-writer:jar:0.0.1.15'
<dependency org="com.github.jcustenborder" name="vertica-stream-writer" rev="0.0.1.15">
  <artifact name="vertica-stream-writer" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.jcustenborder', module='vertica-stream-writer', version='0.0.1.15')
)
libraryDependencies += "com.github.jcustenborder" % "vertica-stream-writer" % "0.0.1.15"
[com.github.jcustenborder/vertica-stream-writer "0.0.1.15"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.guava : guava jar 18.0
org.apache.commons : commons-compress jar 1.13
org.anarres.lzo : lzo-core Optional jar 1.0.5

provided (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.21

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-M3
org.junit.jupiter : junit-jupiter-api jar 5.0.0-M3
org.mockito : mockito-core jar 1.10.19
ch.qos.logback : logback-classic jar 1.1.8

Project Modules

There are no modules declared in this project.

Maven Central

Introduction

This library is a helper library to stream data in the Vertica Native Binary Format. The goal is to use a VerticaCopyStream to import data to Vertica in the most efficient way possible.

Dependency

<dependency>
    <groupId>com.github.jcustenborder</groupId>
    <artifactId>vertica-stream-writer</artifactId>
    <version>[0.0.1.1,]</version>
</dependency>

LZO Support

LZO compression support is optional due to the licensing with the upstream library. To enable it you must add the following to your pom to bring in the library.

<dependency>
    <groupId>org.anarres.lzo</groupId>
    <artifactId>lzo-core</artifactId>
    <version>1.0.5</version>    
</dependency>

Example

Below is a direct example of building the example file defined in the Vertica Documentation Creating Native Binary Format Files

    VerticaStreamWriterBuilder streamWriterBuilder = new VerticaStreamWriterBuilder()
        .table("allTypes")
        .column("INTCOL", VerticaType.INTEGER, 8)
        .column("FLOATCOL", VerticaType.FLOAT)
        .column("CHARCOL", VerticaType.CHAR, 10)
        .column("VARCHARCOL", VerticaType.VARCHAR)
        .column("BOOLCOL", VerticaType.BOOLEAN)
        .column("DATECOL", VerticaType.DATE)
        .column("TIMESTAMPCOL", VerticaType.TIMESTAMP)
        .column("TIMESTAMPTZCOL", VerticaType.TIMESTAMPTZ)
        .column("TIMECOL", VerticaType.TIME)
        .column("TIMETZCOL", VerticaType.TIMETZ)
        .column("VARBINCOL", VerticaType.VARBINARY)
        .column("BINCOL", VerticaType.BINARY, 3)
        .column("NUMCOL", VerticaType.NUMERIC, 38, 0)
        .column("INTERVALCOL", VerticaType.INTERVAL);

    Object[] row = new Object[]{
        1,
        -1.11D,
        "one       ",
        "ONE",
        true,
        new Date(915753600000L),
        new Date(919739512350L),
        date("yyyy-MM-dd HH:mm:ssX", "1999-01-08 07:04:37-05"),
        date("HH:mm:ss", "07:09:23"),
        date("HH:mm:ssX", "15:12:34-05"),
        BaseEncoding.base16().decode("ABCD"),
        BaseEncoding.base16().decode("ABCD"),
        BigDecimal.valueOf(1234532),
        (Duration.ofHours(3).plusMinutes(3).plusSeconds(3).toMillis() * 1000L)
    };

    assertEquals(14, streamWriterBuilder.columnInfos.size(), "column count should match.");

    final String actual;

    try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
      try (VerticaStreamWriter streamWriter = streamWriterBuilder.build(outputStream)) {
        streamWriter.write(row);
      }
    }

Versions

Version
0.0.1.15
0.0.1.14
0.0.1.13
0.0.1.12
0.0.1.11
0.0.1.10
0.0.1.9
0.0.1.8
0.0.1.7
0.0.1.6
0.0.1.5
0.0.1.3
0.0.1.2