Skip to content

Commit 6728113

Browse files
committed
build: convert to multi-module Maven layout and add examples module
Restructure the repository into a multi-module Maven build so a new examples/ module can depend on the library and stay in sync with the API automatically. * pom.xml becomes the parent (datafusion-java-parent, packaging=pom) with dependencyManagement for shared versions. * core/ holds the existing library; src/ moves to core/src/. * examples/ is a new module (datafusion-java-examples) depending on datafusion-java via ${project.version}. It wires exec-maven-plugin so each example can be launched with the right java.library.path and --add-opens flags. * native/, proto/, Makefile, and mvnw stay at the repo root. * Surefire's java.library.path uses ${maven.multiModuleProjectDirectory} so the path resolves correctly under the reactor. Three runnable examples: * SqlQueryExample: registerCsv + SQL aggregation. * DataFrameExample: readCsv -> filter / select / rename / distinct -> writeParquet -> readParquet round-trip. * ProtoPlanExample: build a LogicalPlanNode via the generated protobuf classes and execute it through SessionContext.fromProto.
1 parent fe54208 commit 6728113

27 files changed

Lines changed: 550 additions & 103 deletions

‎core/pom.xml‎

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
23+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<parent>
27+
<groupId>org.apache.datafusion</groupId>
28+
<artifactId>datafusion-java-parent</artifactId>
29+
<version>0.1.0-SNAPSHOT</version>
30+
</parent>
31+
32+
<artifactId>datafusion-java</artifactId>
33+
<packaging>jar</packaging>
34+
35+
<name>Apache DataFusion Java</name>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>org.junit.jupiter</groupId>
40+
<artifactId>junit-jupiter</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.arrow</groupId>
45+
<artifactId>arrow-vector</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.apache.arrow</groupId>
49+
<artifactId>arrow-c-data</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.apache.arrow</groupId>
53+
<artifactId>arrow-memory-netty</artifactId>
54+
<scope>runtime</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>com.google.protobuf</groupId>
58+
<artifactId>protobuf-java</artifactId>
59+
</dependency>
60+
</dependencies>
61+
62+
<build>
63+
<extensions>
64+
<extension>
65+
<groupId>kr.motd.maven</groupId>
66+
<artifactId>os-maven-plugin</artifactId>
67+
<version>1.7.1</version>
68+
</extension>
69+
</extensions>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-surefire-plugin</artifactId>
74+
<configuration>
75+
<argLine>-Djava.library.path=${maven.multiModuleProjectDirectory}/native/target/debug --add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
76+
</configuration>
77+
</plugin>
78+
<plugin>
79+
<groupId>com.googlecode.maven-download-plugin</groupId>
80+
<artifactId>download-maven-plugin</artifactId>
81+
<version>1.9.0</version>
82+
<executions>
83+
<execution>
84+
<id>fetch-datafusion-common-proto</id>
85+
<phase>generate-sources</phase>
86+
<goals><goal>wget</goal></goals>
87+
<configuration>
88+
<url>https://raw.githubusercontent.com/apache/datafusion/${datafusion.version}/datafusion/proto-common/proto/datafusion_common.proto</url>
89+
<outputDirectory>${project.build.directory}/proto/datafusion/proto-common/proto</outputDirectory>
90+
<outputFileName>datafusion_common.proto</outputFileName>
91+
<sha512>d6f3368372ea277cc23e26f196994b81616d38599357bb374cbd7eb1760e649a789e4c133d86a395ac701049a500348da2ec039d3f978ac5d8112c2876dded1f</sha512>
92+
</configuration>
93+
</execution>
94+
<execution>
95+
<id>fetch-datafusion-proto</id>
96+
<phase>generate-sources</phase>
97+
<goals><goal>wget</goal></goals>
98+
<configuration>
99+
<url>https://raw.githubusercontent.com/apache/datafusion/${datafusion.version}/datafusion/proto/proto/datafusion.proto</url>
100+
<outputDirectory>${project.build.directory}/proto/datafusion/proto/proto</outputDirectory>
101+
<outputFileName>datafusion.proto</outputFileName>
102+
<sha512>c3d162b8e2a418e03f74caceaccfd934af89bb95a12ede13d4cc1701d24c734d74b1e96372142b173db05938dab7f965ad60d476363308c441677a63ea5fbcf7</sha512>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
<plugin>
108+
<groupId>org.xolstice.maven.plugins</groupId>
109+
<artifactId>protobuf-maven-plugin</artifactId>
110+
<version>0.6.1</version>
111+
<configuration>
112+
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
113+
<protoSourceRoot>${project.build.directory}/proto</protoSourceRoot>
114+
</configuration>
115+
<executions>
116+
<execution>
117+
<id>compile-upstream</id>
118+
<goals><goal>compile</goal></goals>
119+
</execution>
120+
<execution>
121+
<id>compile-local</id>
122+
<goals><goal>compile</goal></goals>
123+
<configuration>
124+
<protoSourceRoot>${maven.multiModuleProjectDirectory}/proto</protoSourceRoot>
125+
<clearOutputDirectory>false</clearOutputDirectory>
126+
</configuration>
127+
</execution>
128+
</executions>
129+
</plugin>
130+
<plugin>
131+
<groupId>org.apache.maven.plugins</groupId>
132+
<artifactId>maven-javadoc-plugin</artifactId>
133+
<configuration>
134+
<source>17</source>
135+
<failOnError>true</failOnError>
136+
<failOnWarnings>false</failOnWarnings>
137+
<doctitle>Apache DataFusion Java ${project.version}</doctitle>
138+
<windowtitle>Apache DataFusion Java ${project.version}</windowtitle>
139+
<links>
140+
<link>https://docs.oracle.com/en/java/javase/17/docs/api/</link>
141+
</links>
142+
<excludePackageNames>datafusion_common:org.apache.datafusion.protobuf</excludePackageNames>
143+
</configuration>
144+
</plugin>
145+
</plugins>
146+
</build>
147+
</project>

src/main/java/org/apache/datafusion/CsvReadOptions.java renamed to core/src/main/java/org/apache/datafusion/CsvReadOptions.java

File renamed without changes.
File renamed without changes.

src/main/java/org/apache/datafusion/NativeLibraryLoader.java renamed to core/src/main/java/org/apache/datafusion/NativeLibraryLoader.java

File renamed without changes.

src/main/java/org/apache/datafusion/ParquetReadOptions.java renamed to core/src/main/java/org/apache/datafusion/ParquetReadOptions.java

File renamed without changes.

src/main/java/org/apache/datafusion/ParquetWriteOptions.java renamed to core/src/main/java/org/apache/datafusion/ParquetWriteOptions.java

File renamed without changes.

src/main/java/org/apache/datafusion/SessionContext.java renamed to core/src/main/java/org/apache/datafusion/SessionContext.java

File renamed without changes.

src/main/java/org/apache/datafusion/SessionContextBuilder.java renamed to core/src/main/java/org/apache/datafusion/SessionContextBuilder.java

File renamed without changes.

src/main/java/org/apache/datafusion/proto/SchemaConverter.java renamed to core/src/main/java/org/apache/datafusion/proto/SchemaConverter.java

File renamed without changes.

src/test/java/org/apache/datafusion/CsvReadOptionsTest.java renamed to core/src/test/java/org/apache/datafusion/CsvReadOptionsTest.java

File renamed without changes.

0 commit comments

Comments
 (0)