From 0e25c2751882bca5ee1680f84db4cfd757e6a3be Mon Sep 17 00:00:00 2001 From: James Duong Date: Wed, 13 Dec 2023 09:25:09 -0800 Subject: [PATCH] Modularize flight-sql --- java/flight/flight-sql/pom.xml | 27 +++++++++++++++++ .../flight-sql/src/main/java/module-info.java | 29 +++++++++++++++++++ .../flight/sql/{ => test}/TestFlightSql.java | 13 +++++++-- .../sql/{ => test}/TestFlightSqlStreams.java | 11 ++++++- 4 files changed, 77 insertions(+), 3 deletions(-) rename java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/{ => test}/TestFlightSql.java (98%) rename java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/{ => test}/TestFlightSqlStreams.java (96%) diff --git a/java/flight/flight-sql/pom.xml b/java/flight/flight-sql/pom.xml index 3ddc1758ae8ef..1c513f894d320 100644 --- a/java/flight/flight-sql/pom.xml +++ b/java/flight/flight-sql/pom.xml @@ -50,6 +50,10 @@ org.apache.arrow arrow-memory-core + + org.immutables + value + org.apache.arrow arrow-jdbc @@ -110,4 +114,27 @@ + + + error-prone-jdk11+ + + [11,] + + !m2e.version + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + --add-reads=org.apache.arrow.flight.sql=org.slf4j --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED + + + + + + + diff --git a/java/flight/flight-sql/src/main/java/module-info.java b/java/flight/flight-sql/src/main/java/module-info.java index e69de29bb2d1d..5514d5b870afd 100644 --- a/java/flight/flight-sql/src/main/java/module-info.java +++ b/java/flight/flight-sql/src/main/java/module-info.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +module org.apache.arrow.flight.sql { + exports org.apache.arrow.flight.sql; + exports org.apache.arrow.flight.sql.example; + exports org.apache.arrow.flight.sql.util; + + requires com.google.common; + requires java.sql; + requires org.apache.arrow.flight.core; + requires org.apache.arrow.memory.core; + requires org.apache.arrow.vector; + requires protobuf.java; +} diff --git a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSql.java b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSql.java similarity index 98% rename from java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSql.java rename to java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSql.java index 7635b80ecd0fd..af6ddf09134f6 100644 --- a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSql.java +++ b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSql.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.arrow.flight; +package org.apache.arrow.flight.sql.test; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; @@ -38,6 +38,15 @@ import java.util.Optional; import java.util.stream.IntStream; +import org.apache.arrow.flight.CancelFlightInfoRequest; +import org.apache.arrow.flight.FlightClient; +import org.apache.arrow.flight.FlightInfo; +import org.apache.arrow.flight.FlightRuntimeException; +import org.apache.arrow.flight.FlightServer; +import org.apache.arrow.flight.FlightStatusCode; +import org.apache.arrow.flight.FlightStream; +import org.apache.arrow.flight.Location; +import org.apache.arrow.flight.RenewFlightEndpointRequest; import org.apache.arrow.flight.sql.FlightSqlClient; import org.apache.arrow.flight.sql.FlightSqlClient.PreparedStatement; import org.apache.arrow.flight.sql.FlightSqlColumnMetadata; @@ -912,7 +921,7 @@ public void testCancelFlightInfo() { FlightInfo info = sqlClient.getSqlInfo(); CancelFlightInfoRequest request = new CancelFlightInfoRequest(info); FlightRuntimeException fre = assertThrows(FlightRuntimeException.class, () -> sqlClient.cancelFlightInfo(request)); - assertEquals(FlightStatusCode.UNIMPLEMENTED, fre.status().code()); + Assertions.assertEquals(FlightStatusCode.UNIMPLEMENTED, fre.status().code()); } @Test diff --git a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSqlStreams.java b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSqlStreams.java similarity index 96% rename from java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSqlStreams.java rename to java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSqlStreams.java index 1dd925eb53add..1dd96f0fd4e9c 100644 --- a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/TestFlightSqlStreams.java +++ b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/test/TestFlightSqlStreams.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.arrow.flight; +package org.apache.arrow.flight.sql.test; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; @@ -28,6 +28,15 @@ import java.util.Collections; import java.util.List; +import org.apache.arrow.flight.CallStatus; +import org.apache.arrow.flight.FlightClient; +import org.apache.arrow.flight.FlightDescriptor; +import org.apache.arrow.flight.FlightEndpoint; +import org.apache.arrow.flight.FlightInfo; +import org.apache.arrow.flight.FlightServer; +import org.apache.arrow.flight.FlightStream; +import org.apache.arrow.flight.Location; +import org.apache.arrow.flight.Ticket; import org.apache.arrow.flight.sql.BasicFlightSqlProducer; import org.apache.arrow.flight.sql.FlightSqlClient; import org.apache.arrow.flight.sql.FlightSqlProducer;