Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
83 changes: 83 additions & 0 deletions .github/workflows/substrait_java_interop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Runs a plan the Substrait crate produces through substrait-java and Spark.
# A DataFusion round trip cannot check a field the consumer never reads, so
# this is what catches a wrong `AggregationPhase`.
#
# It pulls a Spark sized dependency set, so it lives in its own workflow and
# the `paths` filters below keep it to changes that can affect it. A job
# filtered that way cannot be a required status check, so this workflow is
# deliberately absent from `required_status_checks` in `.asf.yaml`, and it
# has no `merge_group` trigger: it would pay the Rust build and the Spark
# download on every merge queue entry without gating anything.

name: Substrait java interop

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

on:
# `rust.yml` runs on a push to any branch, which is what makes a fork PR run
# on the fork; this workflow follows it so its fork clause works the same way.
# The merge queue's own branches are left out: the job gates nothing there.
push:
branches-ignore:
- "gh-readonly-queue/**"
- "dependabot/**"
paths:
- "datafusion/substrait/**"
- ".github/workflows/substrait_java_interop.yml"

pull_request:
paths:
- "datafusion/substrait/**"
- ".github/workflows/substrait_java_interop.yml"

permissions:
contents: read

jobs:
substrait-java-interop:
name: Run the Substrait java interop test
# A PR from a fork runs this on the fork, as the jobs in `rust.yml` do, so
# upstream does not pay for a Rust build and a Spark download on every
# contributor PR that touches the crate.
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork && github.base_ref == 'main') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The `substrait` crate's build script runs protoc, which is not
# preinstalled on ubuntu-latest runners.
- name: Install protoc
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
with:
tool: protoc@3.21.12
# The build script also runs rustfmt over the generated code.
- name: Setup Rust toolchain
run: rustup component add rustfmt
- name: Setup Java
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6
with:
distribution: temurin
java-version: "17"
cache: maven
- name: Write the plan
run: cargo test -p datafusion-substrait --test substrait_integration -- --ignored write_java_interop_plan
- name: Convert it with substrait-java and run it in Spark
run: mvn -B -f datafusion/substrait/java-interop/pom.xml test
119 changes: 119 additions & 0 deletions datafusion/substrait/java-interop/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.datafusion</groupId>
<artifactId>datafusion-substrait-java-interop</artifactId>
<version>1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DataFusion Substrait java interop test</name>
<description>
Reads a Substrait plan produced by DataFusion, converts it with
substrait-java and runs it in Spark, so that fields DataFusion writes but
never reads back are checked against another implementation.
</description>

<properties>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<substrait.version>0.103.0</substrait.version>
<spark.version>3.5.4</spark.version>
<!-- substrait-java pulls a newer Jackson than Spark 3.5 accepts. -->
<jackson.version>2.15.2</jackson.version>
</properties>

<dependencies>
<dependency>
<groupId>io.substrait</groupId>
<artifactId>spark35_2.12</artifactId>
<version>${substrait.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.11.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<!-- Spark 3.5 on JDK 17 needs these opens. -->
<argLine>
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED
--add-opens=java.base/sun.security.action=ALL-UNNAMED
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED
</argLine>
<environmentVariables>
<SPARK_LOCAL_IP>127.0.0.1</SPARK_LOCAL_IP>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading
Loading