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
4 changes: 4 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ make benchmark-org.apache.spark.sql.benchmark.CometReadBenchmark
To run TPC-H or TPC-DS micro benchmarks, please follow the instructions
in the respective source code, e.g., `CometTPCHQueryBenchmark`.

## Style

You can fix Scala style issues using spotless by running `make format`.

## Debugging
Comet is a multi-language project with native code written in Rust and JVM code written in Java and Scala.
It is possible to debug both native and JVM code concurrently as described in the [DEBUGGING guide](DEBUGGING.md)
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ bench:
RUSTFLAGS="-Ctarget-cpu=native" cargo bench $(filter-out $@,$(MAKECMDGOALS))
format:
./mvnw compile test-compile scalafix:scalafix -Psemanticdb $(PROFILES)
./mvnw spotless:apply $(PROFILES)
./mvnw spotless:apply $(PROFILES) -Pspark-3.5
./mvnw spotless:apply $(PROFILES) -Pspark-3.4
./mvnw spotless:apply $(PROFILES) -Pspark-3.3
./mvnw spotless:apply $(PROFILES) -Pspark-3.2


core-amd64:
rustup target add x86_64-apple-darwin
Expand Down
18 changes: 16 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ under the License.

<modules>
<module>common</module>
<module>shims</module>
<module>spark</module>
<module>spark-integration</module>
</modules>
Expand All @@ -46,8 +47,8 @@ under the License.
<scala.plugin.version>4.7.2</scala.plugin.version>
<scalatest.version>3.2.9</scalatest.version>
<scalatest-maven-plugin.version>2.0.2</scalatest-maven-plugin.version>
<spark.version>3.4.2</spark.version>
<spark.version.short>3.4</spark.version.short>
<spark.version>3.5.1</spark.version>
<spark.version.short>3.5</spark.version.short>
<spark.maven.scope>provided</spark.maven.scope>
<protobuf.version>3.19.6</protobuf.version>
<parquet.version>1.13.1</parquet.version>
Expand Down Expand Up @@ -516,6 +517,19 @@ under the License.
<properties>
<scala.version>2.12.17</scala.version>
<spark.version.short>3.4</spark.version.short>
<spark.version>3.4.2</spark.version>
<parquet.version>1.13.1</parquet.version>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
</profile>

<profile>
<id>spark-3.5</id>
<properties>
<scala.version>2.12.17</scala.version>
<spark.version.short>3.5</spark.version.short>
<parquet.version>1.13.1</parquet.version>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
Expand Down
5 changes: 5 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<settings>
<activeProfiles>
<activeProfile>spark-3.4</activeProfile>
</activeProfiles>
</settings>
128 changes: 128 additions & 0 deletions shims/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?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>
<parent>
<groupId>org.apache.comet</groupId>
<artifactId>comet-parent-spark${spark.version.short}_${scala.binary.version}</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>comet-spark-per-spark-shims</artifactId>
<name>comet-spark-per-spark-shims</name>
<packaging>pom</packaging>

<properties>
<!-- Reverse default (skip installation), and then enable only for child modules -->
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.binary.version}</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- create a maven pom property that has all of our dependencies.
below in the integration-test phase we'll pass this list
of paths to our jar checker script.
-->
<execution>
<id>put-client-artifacts-in-a-property</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<pathSeparator>;</pathSeparator>
<outputProperty>comet-artifacts</outputProperty>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>check-jar-contents</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
<requiresOnline>false</requiresOnline>
<arguments>
<argument>${project.basedir}/../dev/ensure-jars-have-correct-contents.sh</argument>
<argument>${comet-artifacts}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>spark-3.2</id>
<modules>
<module>pre-spark-3.5</module>
</modules>
</profile>
<profile>
<id>spark-3.3</id>
<modules>
<module>pre-spark-3.5</module>
</modules>
</profile>
<profile>
<id>spark-3.4</id>
<modules>
<module>pre-spark-3.5</module>
</modules>
</profile>
<profile>
<id>spark-3.5</id>
<modules>
<module>spark-3.5</module>
</modules>
</profile>
</profiles>
</project>
99 changes: 99 additions & 0 deletions shims/pre-spark-3.5/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?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>
<parent>
<groupId>org.apache.comet</groupId>
<artifactId>comet-spark-per-spark-shims</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>comet-spark-per-spark-shims${spark.version.short}_${scala.binary.version}</artifactId>
<name>comet-spark-per-spark-shims${spark.version.short}_${scala.binary.version}</name>

<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.binary.version}</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- create a maven pom property that has all of our dependencies.
below in the integration-test phase we'll pass this list
of paths to our jar checker script.
-->
<execution>
<id>put-client-artifacts-in-a-property</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<pathSeparator>;</pathSeparator>
<outputProperty>comet-artifacts</outputProperty>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>check-jar-contents</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
<requiresOnline>false</requiresOnline>
<arguments>
<argument>${project.basedir}/../dev/ensure-jars-have-correct-contents.sh</argument>
<argument>${comet-artifacts}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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.
*/

package org.apache.comet.shims

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.execution.PartitionedFileUtil
import org.apache.spark.sql.execution.datasources._

class PartitionShim {

def getPartitionedFile(
file: FileStatusWithMetadata,
partitionValues: InternalRow): PartitionedFile = {
PartitionedFileUtil.getPartitionedFile(file, f.getPath, partitionValues)
}

def splitFiles(
sparkSession: SparkSession,
file: FileStatusWithMetadata,
isSplitable: Boolean,
maxSplitBytes: Long,
partitionValues: InternalRow): Seq[PartitionedFile] = {
PartitionedFileUtil.splitFiles(
sparkSession = sparkSession,
file = file,
filePath = file.getPath,
isSplitable = isSplitable,
maxSplitBytes = maxSplitBytes,
partitionValues = partitionValues)
}
}
Loading