Skip to content

Commit

Permalink
IMPALA-10198 (part 1): Unify Java in a single java/ directory
Browse files Browse the repository at this point in the history
This changes all existing Java code to be submodules under
a single root pom. The root pom is impala-parent/pom.xml
with minor changes to add submodules.

This avoids most of the weird CMake/maven interactions,
because there is now a single maven invocation for all
the Java code.

This moves all the Java projects other than fe into
a top level java directory. fe is left where it is
to avoid disruption (but still is compiled via the
java directory's root pom). Various pieces of code
that reference the old locations are updated.

Based on research, there are two options for dealing
with the shaded dependencies. The first is to have an
entirely separate Maven project with a separate Maven
invocation. In this case, the consumers of the shaded
jars will see the reduced set of transitive dependencies.
The second is to have the shaded dependencies as modules
with a single Maven invocation. The consumer would see
all of the original transitive dependencies and need to
exclude them all. See MSHADE-206/MNG-5899. This chooses
the second.

This only moves code around and does not focus on version
numbers or making "mvn versions:set" work.

Testing:
 - Ran a core job
 - Verified existing maven commands from fe/ directory still work
 - Compared the *-classpath.txt files from fe and executor-deps
   and verified they are the same except for paths

Change-Id: I08773f4f9d7cb269b0491080078d6e6f490d8d7a
Reviewed-on: http://gerrit.cloudera.org:8080/16500
Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
Tested-by: Joe McDonnell <joemcdonnell@cloudera.com>
  • Loading branch information
joemcdonnell committed Oct 15, 2020
1 parent 398f17f commit 9785647
Show file tree
Hide file tree
Showing 77 changed files with 57 additions and 190 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,10 @@ endif()
add_subdirectory(common/function-registry)
add_subdirectory(common/thrift)
add_subdirectory(common/fbs)
add_subdirectory(common/yarn-extras)
add_subdirectory(common/protobuf)
add_subdirectory(be)
add_subdirectory(docker)
add_subdirectory(mvn-deps/shaded-deps/hive-exec)
add_subdirectory(mvn-deps/shaded-deps/s3a-aws-sdk)
add_subdirectory(mvn-deps/executor-deps)
add_subdirectory(fe)
add_subdirectory(impala-parent)
add_subdirectory(ext-data-source)
add_subdirectory(query-event-hook-api)
add_subdirectory(java)

# Build target for all generated files which most backend code depends on
add_custom_target(gen-deps ALL DEPENDS thrift-deps proto-deps fb-deps
Expand Down
4 changes: 2 additions & 2 deletions bin/clean-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ if [[ -z "${IMPALA_HOME}" || ! -d "${IMPALA_HOME}" ]]; then
fi
# Remove trailing /
ROOT_DIR=${IMPALA_HOME%%/}
for loc in "${ROOT_DIR}/ -maxdepth 1" "${ROOT_DIR}/be/" "${ROOT_DIR}/fe/" "${ROOT_DIR}/common/"\
"${ROOT_DIR}/ext-data-source/"; do
for loc in "${ROOT_DIR}/ -maxdepth 1" "${ROOT_DIR}/be/" "${ROOT_DIR}/java/" \
"${ROOT_DIR}/common/" ; do
find ${loc} \( -iname CMakeCache.txt -o -iname CMakeFiles \
-o -iname CTestTestfile.cmake -o -iname cmake_install.cmake \) -exec rm -Rf {} +
done
Expand Down
2 changes: 1 addition & 1 deletion bin/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ setup_report_build_error
"${MAKE_CMD:-make}" clean || :

# clean the external data source project
pushd "${IMPALA_HOME}/ext-data-source"
pushd "${IMPALA_HOME}/java/ext-data-source"
rm -rf api/generated-sources/*
${IMPALA_HOME}/bin/mvn-quiet.sh clean
popd
Expand Down
6 changes: 4 additions & 2 deletions bin/create_testdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ bin=`cd "$bin"; pwd`
DATALOC=$IMPALA_HOME/testdata/target

# regenerate the test data generator
cd $IMPALA_HOME/testdata
cd $IMPALA_HOME/java/datagenerator
${IMPALA_HOME}/bin/mvn-quiet.sh clean
${IMPALA_HOME}/bin/mvn-quiet.sh package

# find jars
CP=""
JARS=`find target/*.jar 2> /dev/null || true`
JARS=`find ${IMPALA_HOME}/java/datagenerator/target/*.jar 2> /dev/null || true`
for i in $JARS; do
if [ -n "$CP" ]; then
CP=${CP}:${i}
Expand All @@ -47,6 +47,8 @@ done
# run test data generator
echo $DATALOC
mkdir -p $DATALOC
pushd $IMPALA_HOME/testdata
"$JAVA" -cp $CP org.apache.impala.datagenerator.TestDataGenerator $DATALOC
"$JAVA" -cp $CP org.apache.impala.datagenerator.CsvToHBaseConverter
echo "SUCCESS, data generated into $DATALOC"
popd
4 changes: 2 additions & 2 deletions buildall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ bootstrap_dependencies() {
# Build the Impala frontend and its dependencies.
build_fe() {
generate_cmake_files $CMAKE_BUILD_TYPE
${MAKE_CMD} ${IMPALA_MAKE_FLAGS} fe
${MAKE_CMD} ${IMPALA_MAKE_FLAGS} java
}

# Build all components. The build type is specified as the first argument, and the
Expand All @@ -449,7 +449,7 @@ build_all_components() {
MAKE_TARGETS="impalad statestored catalogd fesupport loggingsupport ImpalaUdf \
udasample udfsample"
if (( build_independent_targets )); then
MAKE_TARGETS+=" cscope fe tarballs"
MAKE_TARGETS+=" cscope java tarballs"
fi
fi
${MAKE_CMD} -j${IMPALA_BUILD_THREADS:-4} ${IMPALA_MAKE_FLAGS} ${MAKE_TARGETS}
Expand Down
2 changes: 1 addition & 1 deletion common/thrift/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ set(THRIFT_INCLUDE_DIR_OPTION -I ${THRIFT_CONTRIB_DIR} -I $ENV{HIVE_METASTORE_TH
set(BE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/be/generated-sources)
set(FE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/fe/generated-sources)
# TODO: avoid duplicating generated java classes
set(EXT_DS_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/ext-data-source/api/generated-sources)
set(EXT_DS_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/java/ext-data-source/api/generated-sources)
set(PYTHON_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/shell/)
set(THRIFT11_PYTHON_OUTPUT_DIR ${PYTHON_OUTPUT_DIR}/build/thrift-11-gen)
MESSAGE("Found output dir: " ${PYTHON_OUTPUT_DIR})
Expand Down
23 changes: 0 additions & 23 deletions common/yarn-extras/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion docker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (NOT ${DISTRO_BASE_IMAGE} STREQUAL "UNSUPPORTED")
# with symlinks
add_custom_target(impala_base_build_context_${build_type}
COMMAND ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py ${build_context_args}
DEPENDS daemons fe ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py
DEPENDS daemons java ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py
COMMENT "Creating impala base build context build_type=${build_type}."
VERBATIM
)
Expand Down
2 changes: 1 addition & 1 deletion docker/setup_build_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def strip_debug_symbols(src_file, dst_dirs):

# Impala Executor dependencies.
dep_classpath = file(os.path.join(IMPALA_HOME,
"mvn-deps/executor-deps/target/build-executor-deps-classpath.txt")).read()
"java/executor-deps/target/build-executor-deps-classpath.txt")).read()
for jar in dep_classpath.split(":"):
assert os.path.exists(jar), "missing jar from classpath: {0}".format(jar)
symlink_file_into_dir(jar, EXEC_LIB_DIR)
Expand Down
23 changes: 0 additions & 23 deletions ext-data-source/CMakeLists.txt

This file was deleted.

22 changes: 0 additions & 22 deletions fe/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion fe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../impala-parent/pom.xml</relativePath>
<relativePath>../java/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
2 changes: 1 addition & 1 deletion impala-parent/CMakeLists.txt → java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
# specific language governing permissions and limitations
# under the License.

add_custom_target(impala-parent ALL
add_custom_target(java ALL DEPENDS gen-deps function-registry
COMMAND $ENV{IMPALA_HOME}/bin/mvn-quiet.sh -B install -DskipTests
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
1 change: 0 additions & 1 deletion testdata/pom.xml → java/datagenerator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
13 changes: 12 additions & 1 deletion mvn-deps/executor-deps/pom.xml → java/executor-deps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down Expand Up @@ -107,6 +106,12 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-minimal-s3a-aws-sdk</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -159,6 +164,12 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-minimal-hive-exec</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- IMPALA-8766: Include Knox jars on the classpath -->
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion ext-data-source/pom.xml → java/ext-data-source/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions impala-parent/pom.xml → java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,17 @@ under the License.
</pluginRepository>
</pluginRepositories>

<modules>
<module>datagenerator</module>
<module>executor-deps</module>
<module>ext-data-source</module>
<module>../fe</module>
<module>query-event-hook-api</module>
<module>shaded-deps/hive-exec</module>
<module>shaded-deps/s3a-aws-sdk</module>
<module>TableFlattener</module>
<module>test-hive-udfs</module>
<module>yarn-extras</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the same dependencies
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ though some of them might not be necessary. The exclusions are sorted alphabetic
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ under the License.
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion common/yarn-extras/pom.xml → java/yarn-extras/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<groupId>org.apache.impala</groupId>
<artifactId>impala-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath>../../impala-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.impala</groupId>
Expand Down
20 changes: 0 additions & 20 deletions mvn-deps/executor-deps/CMakeLists.txt

This file was deleted.

20 changes: 0 additions & 20 deletions mvn-deps/shaded-deps/hive-exec/CMakeLists.txt

This file was deleted.

20 changes: 0 additions & 20 deletions mvn-deps/shaded-deps/s3a-aws-sdk/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 9785647

Please sign in to comment.