<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>presto-root</artifactId>
        <groupId>com.facebook.presto</groupId>
        <version>0.298</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>presto-spark-base</artifactId>
    <name>presto-spark-base</name>

    <properties>
        <air.main.basedir>${project.parent.basedir}</air.main.basedir>
        <air.check.skip-modernizer>true</air.check.skip-modernizer>
        <dep.jetty.version>9.4.55.v20240627</dep.jetty.version>
        <dep.okhttp.version>4.12.0</dep.okhttp.version>
        <dep.okio-jvm.version>3.9.1</dep.okio-jvm.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- This is to ensure spark gets the right version of the jersey libs -->
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>2.22.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.facebook.airlift</groupId>
                <artifactId>event</artifactId>
                <version>0.216</version>
            </dependency>
            <dependency>
                <groupId>com.facebook.airlift</groupId>
                <artifactId>discovery</artifactId>
                <version>0.216</version>
            </dependency>
            <dependency>
                <groupId>com.facebook.drift</groupId>
                <artifactId>drift-codec</artifactId>
                <version>1.46</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-spark-classloader-interface</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-client</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.facebook.airlift.drift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-parser</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-analyzer</artifactId>
        </dependency>

        <dependency>
            <groupId>com.github.luben</groupId>
            <artifactId>zstd-jni</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto.spark</groupId>
            <artifactId>spark-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Presto -->
        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-common</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-spark-common</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-spi</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-main-base</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.facebook.airlift.drift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.facebook.presto</groupId>
                    <artifactId>presto-function-namespace-managers-common</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-expressions</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-matching</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-memory-context</artifactId>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>slice</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>units</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>stats</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>json</artifactId>
        </dependency>

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>${dep.okhttp.version}</version>
        </dependency>

        <dependency>
            <groupId>com.squareup.okio</groupId>
            <artifactId>okio-jvm</artifactId>
            <version>${dep.okio-jvm.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>concurrent</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>configuration</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>bootstrap</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>node</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>log</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.airlift</groupId>
            <artifactId>log-manager</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>org.pcollections</groupId>
            <artifactId>pcollections</artifactId>
        </dependency>

        <dependency>
            <groupId>org.weakref</groupId>
            <artifactId>jmxutils</artifactId>
        </dependency>

        <dependency>
            <groupId>org.openjdk.jol</groupId>
            <artifactId>jol-core</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
        </dependency>

        <dependency>
            <groupId>it.unimi.dsi</groupId>
            <artifactId>fastutil</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </dependency>
        <!-- needed by tests at runtime -->
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- needed by tests at runtime -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.drift</groupId>
            <artifactId>drift-codec</artifactId>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-testng-services</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto.hadoop</groupId>
            <artifactId>hadoop-apache</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-tpch</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift.tpch</groupId>
            <artifactId>tpch</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-hive</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.facebook.airlift</groupId>
                    <artifactId>http-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.xerial.snappy</groupId>
                    <artifactId>snappy-java</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.roaringbitmap</groupId>
                    <artifactId>RoaringBitmap</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.facebook.airlift.drift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-function-namespace-managers-common</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-hive-metastore</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-tests</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.facebook.airlift</groupId>
                    <artifactId>http-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.facebook.airlift</groupId>
                    <artifactId>http-server</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.inject</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.glassfish.hk2.external</groupId>
                    <artifactId>aopalliance-repackaged</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.hk2.external</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-function-namespace-managers</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.facebook.airlift</groupId>
                    <artifactId>http-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-netty-shaded</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.facebook.presto</groupId>
            <artifactId>presto-main-base</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.basepom.maven</groupId>
                <artifactId>duplicate-finder-maven-plugin</artifactId>
                <configuration>
                    <ignoredResourcePatterns>
                        <ignoredResourcePattern>parquet.thrift</ignoredResourcePattern>
                        <ignoredResourcePattern>about.html</ignoredResourcePattern>
                        <ignoredResourcePattern>mozilla/public-suffix-list.txt</ignoredResourcePattern>
                    </ignoredResourcePatterns>
                    <ignoredClassPatterns>
                        <ignoredClassPattern>shaded.parquet.it.unimi.dsi.fastutil.*</ignoredClassPattern>
                        <ignoredClassPattern>module-info</ignoredClassPattern>
                        <ignoredClassPattern>com.esotericsoftware.kryo.*</ignoredClassPattern>
                        <ignoredClassPattern>com.esotericsoftware.minlog.Log</ignoredClassPattern>
                        <ignoredClassPattern>com.esotericsoftware.reflectasm.*</ignoredClassPattern>
                        <ignoredClassPattern>META-INF.versions.9.module-info</ignoredClassPattern>
                        <ignoredClassPattern>com.facebook.drift.*</ignoredClassPattern>
                        <ignoredClassPattern>io.jsonwebtoken.*</ignoredClassPattern>
                    </ignoredClassPatterns>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <ignoredNonTestScopedDependencies>
                        <ignoredNonTestScopedDependency>com.facebook.presto:presto-expressions</ignoredNonTestScopedDependency>
                        <ignoredNonTestScopedDependency>it.unimi.dsi:fastutil</ignoredNonTestScopedDependency>
                        <ignoredNonTestScopedDependency>com.facebook.airlift:log-manager</ignoredNonTestScopedDependency>
                        <ignoredNonTestScopedDependency>com.squareup.okio:okio-jvm</ignoredNonTestScopedDependency>
                    </ignoredNonTestScopedDependencies>
                    <ignoredUnusedDeclaredDependencies>
                        <ignoredUnusedDeclaredDependency>javax.ws.rs:javax.ws.rs-api</ignoredUnusedDeclaredDependency>
                        <ignoredUnusedDeclaredDependency>javax.servlet:javax.servlet-api</ignoredUnusedDeclaredDependency>
                        <ignoredUnusedDeclaredDependency>com.google.code.findbugs:jsr305</ignoredUnusedDeclaredDependency>
                        <ignoredUnusedDeclaredDependency>javax.inject:javax.inject</ignoredUnusedDeclaredDependency>
                        <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>
                        <ignoredUnusedDeclaredDependency>org.apache.httpcomponents:httpcore</ignoredUnusedDeclaredDependency>
                    </ignoredUnusedDeclaredDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>presto-spark-tests-smoke</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>**/TestPrestoSparkAggregations.java</exclude>
                                <exclude>**/TestPrestoSparkJoinQueries.java</exclude>
                                <exclude>**/TestPrestoSparkOrderByQueries.java</exclude>
                                <exclude>**/TestPrestoSparkWindowQueries.java</exclude>
                                <exclude>**/TestPrestoSparkSpilledAggregations.java</exclude>
                                <exclude>**/TestPrestoSparkSpilledJoinQueries.java</exclude>
                                <exclude>**/TestPrestoSparkNativeExecution.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>presto-spark-tests-all-queries</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>**/TestPrestoSparkAggregations.java</include>
                                <include>**/TestPrestoSparkJoinQueries.java</include>
                                <include>**/TestPrestoSparkOrderByQueries.java</include>
                                <include>**/TestPrestoSparkWindowQueries.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>presto-spark-tests-spill-queries</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>**/TestPrestoSparkSpilledAggregations.java</include>
                                <include>**/TestPrestoSparkSpilledJoinQueries.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>spark2</id>

            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>!spark-version</name>
                </property>
            </activation>

            <dependencies>
                <dependency>
                    <groupId>com.facebook.presto</groupId>
                    <artifactId>presto-spark-classloader-spark2</artifactId>
                    <version>${project.version}</version>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>spark3</id>

            <activation>
                <property>
                    <name>spark-version</name>
                    <value>3</value>
                </property>
            </activation>

            <dependencies>
                <dependency>
                    <groupId>com.facebook.presto</groupId>
                    <artifactId>presto-spark-classloader-spark3</artifactId>
                    <version>${project.version}</version>
                </dependency>

                <dependency>
                    <groupId>com.facebook.presto.spark</groupId>
                    <artifactId>spark-core</artifactId>
                    <version>3.4.1-1</version>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>jakarta.annotation</groupId>
                    <artifactId>jakarta.annotation-api</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>org.weakref</groupId>
                    <artifactId>jmxutils</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>jakarta.validation</groupId>
                    <artifactId>jakarta.validation-api</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                    <scope>provided</scope>
                </dependency>

            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <configuration>
                            <ignoredDependencies>
                                <ignoredDependency>org.glassfish.hk2.external:jakarta.inject</ignoredDependency>
                                <ignoredDependency>org.apache.hadoop:hadoop-client-api</ignoredDependency>
                                <ignoredDependency>jakarta.annotation:jakarta.annotation-api</ignoredDependency>
                                <ignoredDependency>jakarta.validation:jakarta.validation-api</ignoredDependency>
                            </ignoredDependencies>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <testExcludes>
                                <!-- skip TestPrestoSparkExecutionExceptionFactory UT to avoid errors of incompatible types between spark 2 and spark 3-->
                                <exclude>**/TestPrestoSparkExecutionExceptionFactory.java</exclude>
                            </testExcludes>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <!-- skip TestPrestoSparkExecutionExceptionFactory UT to avoid errors of incompatible types between spark 2 and spark 3-->
                                <exclude>**/TestPrestoSparkExecutionExceptionFactory.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

        </profile>
    </profiles>
</project>
