Skip to content

Commit 229bc3e

Browse files
Use Flatbuffer Field type instead of MaterializedField
Remove MaterializedField, MajorType, RepeatedTypes
1 parent fab4c82 commit 229bc3e

File tree

66 files changed

+1373
-5364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1373
-5364
lines changed

format/Message.fbs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace apache.arrow.flatbuf;
1+
namespace org.apache.arrow.flatbuf;
22

33
/// ----------------------------------------------------------------------
44
/// Logical types and their metadata (if any)
@@ -48,6 +48,12 @@ table Decimal {
4848
scale: int;
4949
}
5050

51+
table Date {
52+
}
53+
54+
table Time {
55+
}
56+
5157
table Timestamp {
5258
timezone: string;
5359
}
@@ -68,6 +74,8 @@ union Type {
6874
Utf8,
6975
Bool,
7076
Decimal,
77+
Date,
78+
Time,
7179
Timestamp,
7280
List,
7381
Tuple,

header

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+

java/format/pom.xml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0"?>
2+
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
3+
license agreements. See the NOTICE file distributed with this work for additional
4+
information regarding copyright ownership. The ASF licenses this file to
5+
You under the Apache License, Version 2.0 (the "License"); you may not use
6+
this file except in compliance with the License. You may obtain a copy of
7+
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
8+
by applicable law or agreed to in writing, software distributed under the
9+
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
10+
OF ANY KIND, either express or implied. See the License for the specific
11+
language governing permissions and limitations under the License. -->
12+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
14+
<modelVersion>4.0.0</modelVersion>
15+
16+
<parent>
17+
<artifactId>arrow-java-root</artifactId>
18+
<groupId>org.apache.arrow</groupId>
19+
<version>0.1-SNAPSHOT</version>
20+
</parent>
21+
22+
<artifactId>arrow-format</artifactId>
23+
<packaging>jar</packaging>
24+
<name>Arrow Format</name>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>com.vlkan</groupId>
29+
<artifactId>flatbuffers</artifactId>
30+
<version>1.2.0-3f79e055</version>
31+
</dependency>
32+
</dependencies>
33+
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.codehaus.mojo</groupId>
38+
<artifactId>exec-maven-plugin</artifactId>
39+
<version>1.4.0</version>
40+
<executions>
41+
<execution>
42+
<goals>
43+
<goal>exec</goal>
44+
</goals>
45+
<phase>generate-sources</phase>
46+
</execution>
47+
</executions>
48+
<configuration>
49+
<executable>flatc</executable>
50+
<arguments>
51+
<argument>--java</argument>
52+
<argument>-o</argument>
53+
<argument>target/generated-sources/</argument>
54+
<argument>../../format/Message.fbs</argument>
55+
</arguments>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>com.mycila</groupId>
60+
<artifactId>license-maven-plugin</artifactId>
61+
<version>2.3</version>
62+
<configuration>
63+
<header>${basedir}/../../header</header>
64+
<includes>
65+
<include>**/*.java</include>
66+
</includes>
67+
</configuration>
68+
<executions>
69+
<execution>
70+
<phase>process-sources</phase>
71+
<goals>
72+
<goal>format</goal>
73+
</goals>
74+
</execution>
75+
</executions>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.codehaus.mojo</groupId>
79+
<artifactId>build-helper-maven-plugin</artifactId>
80+
<version>1.9.1</version>
81+
<executions>
82+
<execution>
83+
<id>add-sources-as-resources</id>
84+
<phase>generate-sources</phase>
85+
<goals>
86+
<goal>add-source</goal>
87+
</goals>
88+
<configuration>
89+
<sources>
90+
<source>${project.build.directory}/generated-sources</source>
91+
</sources>
92+
</configuration>
93+
</execution>
94+
</executions>
95+
</plugin>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-checkstyle-plugin</artifactId>
99+
<configuration>
100+
<skip>true</skip>
101+
</configuration>
102+
</plugin>
103+
</plugins>
104+
105+
</build>
106+
</project>
107+

java/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@
462462
</dependencies>
463463

464464
<modules>
465+
<module>format</module>
465466
<module>memory</module>
466467
<module>vector</module>
467468
</modules>

java/vector/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222

2323
<dependencies>
2424

25+
<dependency>
26+
<groupId>org.apache.arrow</groupId>
27+
<artifactId>arrow-format</artifactId>
28+
<version>0.1-SNAPSHOT</version>
29+
</dependency>
2530
<dependency>
2631
<groupId>org.apache.arrow</groupId>
2732
<artifactId>arrow-memory</artifactId>

java/vector/src/main/codegen/data/ValueVectorTypes.tdd

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
{
1818
modes: [
1919
{name: "Optional", prefix: "Nullable"},
20-
{name: "Required", prefix: ""},
21-
{name: "Repeated", prefix: "Repeated"}
20+
{name: "Required", prefix: ""}
2221
],
2322
types: [
2423
{
@@ -61,9 +60,7 @@
6160
{ class: "Int", valueHolder: "IntHolder"},
6261
{ class: "UInt4", valueHolder: "UInt4Holder" },
6362
{ class: "Float4", javaType: "float" , boxedType: "Float", fields: [{name: "value", type: "float"}]},
64-
{ class: "Time", javaType: "int", friendlyType: "DateTime" },
65-
{ class: "IntervalYear", javaType: "int", friendlyType: "Period" }
66-
{ class: "Decimal9", maxPrecisionDigits: 9, friendlyType: "BigDecimal", fields: [{name:"value", type:"int"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] },
63+
{ class: "Time", javaType: "int", friendlyType: "DateTime" }
6764
]
6865
},
6966
{
@@ -78,69 +75,6 @@
7875
{ class: "Float8", javaType: "double" , boxedType: "Double", fields: [{name: "value", type: "double"}], },
7976
{ class: "Date", javaType: "long", friendlyType: "DateTime" },
8077
{ class: "TimeStamp", javaType: "long", friendlyType: "DateTime" }
81-
{ class: "Decimal18", maxPrecisionDigits: 18, friendlyType: "BigDecimal", fields: [{name:"value", type:"long"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] },
82-
<#--
83-
{ class: "Money", maxPrecisionDigits: 2, scale: 1, },
84-
-->
85-
]
86-
},
87-
{
88-
major: "Fixed",
89-
width: 12,
90-
javaType: "ArrowBuf",
91-
boxedType: "ArrowBuf",
92-
minor: [
93-
{ class: "IntervalDay", millisecondsOffset: 4, friendlyType: "Period", fields: [ {name: "days", type:"int"}, {name: "milliseconds", type:"int"}] }
94-
]
95-
},
96-
{
97-
major: "Fixed",
98-
width: 16,
99-
javaType: "ArrowBuf"
100-
boxedType: "ArrowBuf",
101-
minor: [
102-
{ class: "Interval", daysOffset: 4, millisecondsOffset: 8, friendlyType: "Period", fields: [ {name: "months", type: "int"}, {name: "days", type:"int"}, {name: "milliseconds", type:"int"}] }
103-
]
104-
},
105-
{
106-
major: "Fixed",
107-
width: 12,
108-
javaType: "ArrowBuf",
109-
boxedType: "ArrowBuf",
110-
minor: [
111-
<#--
112-
{ class: "TimeTZ" },
113-
{ class: "Interval" }
114-
-->
115-
{ class: "Decimal28Dense", maxPrecisionDigits: 28, nDecimalDigits: 3, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
116-
]
117-
},
118-
{
119-
major: "Fixed",
120-
width: 16,
121-
javaType: "ArrowBuf",
122-
boxedType: "ArrowBuf",
123-
124-
minor: [
125-
{ class: "Decimal38Dense", maxPrecisionDigits: 38, nDecimalDigits: 4, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
126-
]
127-
},
128-
{
129-
major: "Fixed",
130-
width: 24,
131-
javaType: "ArrowBuf",
132-
boxedType: "ArrowBuf",
133-
minor: [
134-
{ class: "Decimal38Sparse", maxPrecisionDigits: 38, nDecimalDigits: 6, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
135-
]
136-
},
137-
{
138-
major: "Fixed",
139-
width: 20,
140-
javaType: "ArrowBuf",
141-
boxedType: "ArrowBuf",
142-
minor: [
143-
{ class: "Decimal28Sparse", maxPrecisionDigits: 28, nDecimalDigits: 5, friendlyType: "BigDecimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}, {name: "scale", type: "int", include: false}, {name: "precision", type: "int", include: false}] }
14478
]
14579
},
14680
{
@@ -151,8 +85,7 @@
15185
fields: [{name: "start", type: "int"}, {name: "end", type: "int"}, {name: "buffer", type: "ArrowBuf"}],
15286
minor: [
15387
{ class: "VarBinary" , friendlyType: "byte[]" },
154-
{ class: "VarChar" , friendlyType: "Text" },
155-
{ class: "Var16Char" , friendlyType: "String" }
88+
{ class: "VarChar" , friendlyType: "Text" }
15689
]
15790
},
15891
{

java/vector/src/main/codegen/includes/vv_imports.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ import com.google.common.collect.ObjectArrays;
1717
import com.google.common.base.Charsets;
1818
import com.google.common.collect.ObjectArrays;
1919

20+
import com.google.flatbuffers.FlatBufferBuilder;
21+
2022
import com.google.common.base.Preconditions;
2123
import io.netty.buffer.*;
2224

2325
import org.apache.commons.lang3.ArrayUtils;
2426

27+
import org.apache.arrow.flatbuf.*;
2528
import org.apache.arrow.memory.*;
2629
import org.apache.arrow.vector.types.Types;
2730
import org.apache.arrow.vector.types.Types.*;

java/vector/src/main/codegen/templates/AbstractFieldWriter.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
*/
3232
@SuppressWarnings("unused")
3333
abstract class AbstractFieldWriter extends AbstractBaseWriter implements FieldWriter {
34-
AbstractFieldWriter(FieldWriter parent) {
35-
super(parent);
36-
}
37-
3834
@Override
3935
public void start() {
4036
throw new IllegalStateException(String.format("You tried to start when you are using a ValueWriter of type %s.", this.getClass().getSimpleName()));

java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
*/
3838
@SuppressWarnings("unused")
3939
abstract class AbstractPromotableFieldWriter extends AbstractFieldWriter {
40-
AbstractPromotableFieldWriter(FieldWriter parent) {
41-
super(parent);
42-
}
43-
4440
/**
4541
* Retrieve the FieldWriter, promoting if it is not a FieldWriter of the specified type
4642
* @param type

java/vector/src/main/codegen/templates/BaseReader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
@SuppressWarnings("unused")
3232
public interface BaseReader extends Positionable{
33-
MajorType getType();
34-
MaterializedField getField();
33+
Field getField();
34+
MinorType getMinorType();
3535
void reset();
3636
void read(UnionHolder holder);
3737
void read(int index, UnionHolder holder);
@@ -60,7 +60,6 @@ public interface RepeatedListReader extends ListReader{
6060

6161
public interface ScalarReader extends
6262
<#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> ${name}Reader, </#list></#list>
63-
<#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> Repeated${name}Reader, </#list></#list>
6463
BaseReader {}
6564

6665
interface ComplexReader{

0 commit comments

Comments
 (0)