Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(java): Put java and spark libraries within a directory maven-projects to help easily manage and extend the multi-module maven projects #474

Merged
merged 9 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ on:
branches:
- main
paths:
- 'java/**'
- 'maven-projects/java/**'
- '.github/workflows/java.yml'
pull_request:
branches:
- main
paths:
- 'java/**'
- 'maven-projects/java/**'
- '.github/workflows/java.yml'

concurrency:
Expand Down Expand Up @@ -61,22 +61,22 @@ jobs:
sudo apt-get install llvm-11 clang-11 lld-11 libclang-11-dev libz-dev -y

- name: Code Format Check
working-directory: java
working-directory: maven-projects/java
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress spotless:check

- name: Build Java Docs
working-directory: java
working-directory: maven-projects/java
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress javadoc:javadoc

- name: Run test
working-directory: java
working-directory: maven-projects/java
run: |
# Temporarily using Java 8, related issue: https://github.com/apache/incubator-graphar/issues/277
export JAVA_HOME=${JAVA_HOME_8_X64}
export LLVM11_HOME=/usr/lib/llvm-11
export GAR_TEST_DATA=$PWD/../testing/
export GAR_TEST_DATA=$PWD/../../testing/
mvn --no-transfer-progress clean test -Dspotless.check.skip=true
4 changes: 2 additions & 2 deletions .github/workflows/pyspark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ on:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- 'pyspark/**'
- '.github/workflows/pyspark.yml'
pull_request:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- 'pyspark/**'
- '.github/workflows/pyspark.yml'

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/spark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ on:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- '.github/workflows/spark.yaml'
pull_request:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- '.github/workflows/spark.yaml'

concurrency:
Expand All @@ -57,20 +57,20 @@ jobs:
submodules: true

- name: Code Format Check
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress spotless:check

- name: Build GraphAr Spark
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
echo "Build ${{ matrix.mvn-profile }}"
mvn --no-transfer-progress clean package -DskipTests -Dspotless.check.skip=true -P ${{ matrix.mvn-profile }}

- name: Build Spark Docs
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
echo "Build ${{ matrix.mvn-profile }}"
Expand All @@ -79,15 +79,15 @@ jobs:
mvn --no-transfer-progress scala:doc

- name: Run test
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
export SPARK_TESTING=1
echo "Test ${{ matrix.mvn-profile }}"
mvn test --no-transfer-progress -Dspotless.check.skip=true -P ${{ matrix.mvn-profile }}

- name: Run Neo4j2GraphAr example
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
scripts/get-spark-to-home.sh ${{ matrix.spark }} ${{ matrix.spark-hadoop }}
Expand All @@ -112,7 +112,7 @@ jobs:
scripts/run-graphar2neo4j.sh

- name: Run Nebula2GraphAr example
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
scripts/get-nebula-to-home.sh
Expand All @@ -138,7 +138,7 @@ jobs:
scripts/run-graphar2nebula.sh

- name: Run Neo4j importer
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
export SPARK_HOME="${HOME}/${{ matrix.spark-hadoop }}"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ programming language.
### The C++ Library

See [GraphAr C++
Library](https://github.com/apache/incubator-graphar/tree/main/cpp) for
Library](./cpp) for
details about the building of the C++ library.

### The Java Library
Expand All @@ -213,20 +213,20 @@ The GraphAr Java library is created with bindings to the C++ library
(currently at version v0.10.0), utilizing
[Alibaba-FastFFI](https://github.com/alibaba/fastFFI) for
implementation. See [GraphAr Java
Library](https://github.com/apache/incubator-graphar/tree/main/java) for
Library](./maven-projects/java) for
details about the building of the Java library.

### The Spark Library

See [GraphAr Spark
Library](https://github.com/apache/incubator-graphar/tree/main/spark)
Library](./maven-projects/spark)
for details about the Spark library.

### The PySpark Library

The GraphAr PySpark library is developed as bindings to the GraphAr
Spark library. See [GraphAr PySpark
Library](https://github.com/apache/incubator-graphar/tree/main/pyspark)
Library](./pyspark)
for details about the PySpark library.

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docs/libraries/java/how_to_develop_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Please refer to
## How To Test

```bash
$ export GAR_TEST_DATA=$PWD/../testing/
$ export GAR_TEST_DATA=$PWD/../../testing/
$ mvn clean test
```

Expand Down
8 changes: 4 additions & 4 deletions docs/libraries/java/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ directory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd java
$ cd maven-projects/java
```

Compile package:
Expand Down Expand Up @@ -120,7 +120,7 @@ if (!graphInfoResult.hasError()) {
```

See [test for
graphinfo](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/graphinfo)
graphinfo](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/graphinfo)
for the complete example.

### Writers
Expand Down Expand Up @@ -177,7 +177,7 @@ writer.sortAndWriteAdjListTable(table, 0, 0); // Write adj list of vertex chunk
```

See [test for
writers](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/writers)
writers](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/writers)
for the complete example.

### Readers
Expand Down Expand Up @@ -211,5 +211,5 @@ StdPair<Long, Long> range = reader.getRange().value();
```

See [test for
readers](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/readers)
readers](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/readers)
for the complete example.
10 changes: 5 additions & 5 deletions docs/libraries/spark/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ See [GraphAr2Neo4j.scala][graphar2neo4j] for the complete example.

:::

[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[transformer-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[transformer-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
18 changes: 9 additions & 9 deletions docs/libraries/spark/spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ For more information on usage, please refer to the examples:
- [Neo4j2GraphAr.scala][neo4j2graphar] and [GraphAr2Neo4j.scala][graphar2neo4j] are examples to conduct data importing/exporting for Neo4j.


[test-graph-info]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphInfo.scala
[test-index-generator]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestIndexGenerator.scala
[test-writer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestWriter.scala
[test-reader]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestReader.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[transform-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
[test-graph-info]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphInfo.scala
[test-index-generator]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestIndexGenerator.scala
[test-writer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestWriter.scala
[test-reader]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestReader.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[transform-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions java/README.md → maven-projects/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Make the graphar-java-library directory as the current working directory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd java
$ cd maven-projects/java
```

Compile package:
Expand Down Expand Up @@ -82,4 +82,4 @@ The API document will be generated in the `target/site/apidocs` directory.

## How to use

Please refer to [GraphAr Java Library Documentation](https://graphar.apache.org/GraphAr/user-guide/java-lib.html).
Please refer to [GraphAr Java Library Documentation](https://graphar.apache.org/docs/libraries/java/).
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pom.xml → maven-projects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<name>Apache GraphAr Root POM</name>
<modules>
<module>java</module>
<module>info</module>
<module>spark</module>
</modules>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions spark/README.md → maven-projects/spark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ repository and navigated to the ``spark`` subdirectory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd spark
$ cd mavens-projects/spark
```


Build the package:

```bash
$ mvn clean package -DskipTests
$ mvn clean install -DskipTests
```

GraphAr Spark uses Maven Profiles to support multiple Spark Versions. By default it is built with Spark 3.2.x or profile `datasources-32`. To built with Spark 3.3.4 use `-P datasources-33` (`mvn clean package -DskipTests -P datasources-33`).
GraphAr Spark uses Maven Profiles to support multiple Spark Versions. By default it is built with Spark 3.2.x or profile `datasources-32`. To built with Spark 3.3.4 use `-P datasources-33` (`mvn clean install -DskipTests -P datasources-33`).

After compilation, the package file graphar-x.x.x-SNAPSHOT-shaded.jar is generated in the directory ``spark/graphar/target/``.

Build the package and run the unit tests:

```bash
$ mvn clean package
$ mvn clean install
```

Build and run the unit tests:
Expand Down Expand Up @@ -231,4 +231,4 @@ The example will import the basketballplayer graph from GraphAr to NebulaGraph a

## How to use

Please refer to our [GraphAr Spark Library Documentation](https://graphar.apache.org/GraphAr/spark/spark-lib.html).
Please refer to our [GraphAr Spark Library Documentation](https://graphar.apache.org/docs/libraries/spark/).
File renamed without changes.
1 change: 1 addition & 0 deletions maven-projects/spark/graphar/src/test/resources/gar-test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pyspark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.PHONY: install_test
install_test:
export JAVA_HOME=${JAVA_HOME_11_X64}
cd ../spark && mvn --no-transfer-progress clean package -DskipTests -Dspotless.check.skip=true && cd ../pyspark
cd ../maven-projects/spark && mvn --no-transfer-progress clean package -DskipTests -Dspotless.check.skip=true && cd ../../pyspark
export PYSPARK_HADOOP_VERSION=3.2
poetry install --with=spark,tests

Expand Down
2 changes: 1 addition & 1 deletion pyspark/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pytest
from pyspark.sql import SparkSession

JARS_PATH = Path(__file__).parent.parent.parent.joinpath("spark").joinpath("graphar").joinpath("target")
JARS_PATH = Path(__file__).parent.parent.parent.joinpath("maven-projects/spark").joinpath("graphar").joinpath("target")
GRAPHAR_SHADED_JAR_PATH = None

for jar_file in JARS_PATH.glob("*.jar"):
Expand Down
1 change: 0 additions & 1 deletion spark/graphar/src/test/resources/gar-test

This file was deleted.

Loading