Search in sources :

Example 6 with Schema

use of org.apache.arrow.vector.types.pojo.Schema in project parquet-mr by apache.

the class TestSchemaConverter method testArrowTimeMicrosecondToParquet.

@Test
public void testArrowTimeMicrosecondToParquet() {
    MessageType expected = converter.fromArrow(new Schema(asList(field("a", new ArrowType.Time(TimeUnit.MICROSECOND, 64))))).getParquetSchema();
    Assert.assertEquals(expected, Types.buildMessage().addField(Types.optional(INT64).as(timeType(false, MICROS)).named("a")).named("root"));
}
Also used : Schema(org.apache.arrow.vector.types.pojo.Schema) ArrowType(org.apache.arrow.vector.types.pojo.ArrowType) MessageType(org.apache.parquet.schema.MessageType) Test(org.junit.Test)

Example 7 with Schema

use of org.apache.arrow.vector.types.pojo.Schema in project beam by apache.

the class BigQueryStorageArrowReader method processReadRowsResponse.

@Override
public void processReadRowsResponse(ReadRowsResponse readRowsResponse) throws IOException {
    com.google.cloud.bigquery.storage.v1.ArrowRecordBatch recordBatch = readRowsResponse.getArrowRecordBatch();
    rowCount = recordBatch.getRowCount();
    this.alloc = new RootAllocator(Long.MAX_VALUE);
    InputStream input = protoSchema.getSerializedSchema().newInput();
    Schema arrowSchema = ArrowConversion.arrowSchemaFromInput(input);
    this.recordBatchIterator = ArrowConversion.rowsFromSerializedRecordBatch(arrowSchema, recordBatch.getSerializedRecordBatch().newInput(), this.alloc);
}
Also used : RootAllocator(org.apache.arrow.memory.RootAllocator) InputStream(java.io.InputStream) Schema(org.apache.arrow.vector.types.pojo.Schema) ArrowSchema(com.google.cloud.bigquery.storage.v1.ArrowSchema)

Example 8 with Schema

use of org.apache.arrow.vector.types.pojo.Schema in project parquet-mr by apache.

the class TestSchemaConverter method testSupportedParquetToArrow.

@Test
public void testSupportedParquetToArrow() throws IOException {
    Schema arrow = converter.fromParquet(supportedTypesParquetSchema).getArrowSchema();
    assertEquals(supportedTypesArrowSchema, arrow);
}
Also used : Schema(org.apache.arrow.vector.types.pojo.Schema) Test(org.junit.Test)

Example 9 with Schema

use of org.apache.arrow.vector.types.pojo.Schema in project parquet-mr by apache.

the class TestSchemaConverter method testParquetInt96ToArrowBinary.

@Test
public void testParquetInt96ToArrowBinary() {
    MessageType parquet = Types.buildMessage().addField(Types.optional(INT96).named("a")).named("root");
    Schema expected = new Schema(asList(field("a", new ArrowType.Binary())));
    Assert.assertEquals(expected, converter.fromParquet(parquet).getArrowSchema());
}
Also used : Schema(org.apache.arrow.vector.types.pojo.Schema) ArrowType(org.apache.arrow.vector.types.pojo.ArrowType) MessageType(org.apache.parquet.schema.MessageType) Test(org.junit.Test)

Example 10 with Schema

use of org.apache.arrow.vector.types.pojo.Schema in project parquet-mr by apache.

the class TestSchemaConverter method testParquetInt96ToArrowTimestamp.

@Test
public void testParquetInt96ToArrowTimestamp() {
    final SchemaConverter converterInt96ToTimestamp = new SchemaConverter(true);
    MessageType parquet = Types.buildMessage().addField(Types.optional(INT96).named("a")).named("root");
    Schema expected = new Schema(asList(field("a", new ArrowType.Timestamp(TimeUnit.NANOSECOND, null))));
    Assert.assertEquals(expected, converterInt96ToTimestamp.fromParquet(parquet).getArrowSchema());
}
Also used : Schema(org.apache.arrow.vector.types.pojo.Schema) ArrowType(org.apache.arrow.vector.types.pojo.ArrowType) MessageType(org.apache.parquet.schema.MessageType) Test(org.junit.Test)

Aggregations

Schema (org.apache.arrow.vector.types.pojo.Schema)20 ArrowType (org.apache.arrow.vector.types.pojo.ArrowType)15 Test (org.junit.Test)15 MessageType (org.apache.parquet.schema.MessageType)13 Field (org.apache.arrow.vector.types.pojo.Field)5 ImmutableList (com.google.common.collect.ImmutableList)2 RootAllocator (org.apache.arrow.memory.RootAllocator)2 ArrowSchema (com.google.cloud.bigquery.storage.v1.ArrowSchema)1 JobConfig (edu.iu.dsc.tws.api.JobConfig)1 Twister2Job (edu.iu.dsc.tws.api.Twister2Job)1 Config (edu.iu.dsc.tws.api.config.Config)1 Twister2Worker (edu.iu.dsc.tws.api.resource.Twister2Worker)1 WorkerEnvironment (edu.iu.dsc.tws.api.resource.WorkerEnvironment)1 ComputeFunc (edu.iu.dsc.tws.api.tset.fn.ComputeFunc)1 MapFunc (edu.iu.dsc.tws.api.tset.fn.MapFunc)1 Table (edu.iu.dsc.tws.common.table.Table)1 ArrowTable (edu.iu.dsc.tws.common.table.arrow.ArrowTable)1 ArrowAllToAll (edu.iu.dsc.tws.comms.table.ArrowAllToAll)1 LogicalPlanBuilder (edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder)1 DataObjectConstants (edu.iu.dsc.tws.data.utils.DataObjectConstants)1