-
Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-53138][CORE][BUILD] Split common-utils Java code into a new module #51868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d2cc2a1
wip
pan3793 944ff9a
mv StorageLevelMapper back to common/utils
pan3793 0329f9e
mv SparkThrowable back to common/utils
pan3793 14fac4a
complete
pan3793 0eae920
fix
pan3793 83a27c3
fix
pan3793 f1e7077
fix mima
pan3793 f29780d
dix docs
pan3793 c228fb7
gha
pan3793 865dec2
strip deps
pan3793 3d28202
fix test
pan3793 53e12eb
maven workflow
pan3793 f7a9867
Resolve conflicts
pan3793 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ | |
| <dependency> | ||
| <groupId>org.apache.spark</groupId> | ||
| <artifactId>spark-tags_${scala.binary.version}</artifactId> | ||
| <scope>test</scope> | ||
| <scope>provided</scope> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this does not change the output of artifacts, but is required to fix the scaladocs packaging |
||
| </dependency> | ||
|
|
||
| <!-- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <?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.spark</groupId> | ||
| <artifactId>spark-parent_2.13</artifactId> | ||
| <version>4.1.0-SNAPSHOT</version> | ||
| <relativePath>../../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>spark-common-utils-java_2.13</artifactId> | ||
| <packaging>jar</packaging> | ||
| <name>Spark Project Common Java Utils</name> | ||
| <url>https://spark.apache.org/</url> | ||
| <properties> | ||
| <sbt.project.name>common-utils-java</sbt.project.name> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.apache.spark</groupId> | ||
| <artifactId>spark-tags_${scala.binary.version}</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-api</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>jul-to-slf4j</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>jcl-over-slf4j</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-slf4j2-impl</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-api</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-1.2-api</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-layout-template-json</artifactId> | ||
| </dependency> | ||
| </dependencies> | ||
| <build> | ||
| <outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory> | ||
| <testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory> | ||
| </build> | ||
| </project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ | |
| import org.apache.spark.internal.SparkLoggerFactory; | ||
| import org.apache.spark.internal.LogKeys; | ||
| import org.apache.spark.internal.MDC; | ||
| import org.apache.spark.util.SparkSystemUtils$; | ||
|
|
||
| /** | ||
| * General utilities available in the network package. Many of these are sourced from Spark's | ||
|
|
@@ -265,9 +264,7 @@ public static void deleteRecursively(File file, FilenameFilter filter) | |
| // On Unix systems, use operating system command to run faster | ||
| // If that does not work out, fallback to the Java IO way | ||
| // We exclude Apple Silicon test environment due to the limited resource issues. | ||
| if (SparkSystemUtils$.MODULE$.isUnix() && filter == null && | ||
| !(SparkSystemUtils$.MODULE$.isMac() && (System.getenv("SPARK_TESTING") != null || | ||
| System.getProperty("spark.testing") != null))) { | ||
| if (isUnix && filter == null && !(isMac && isTesting())) { | ||
| try { | ||
| deleteRecursivelyUsingUnixNative(file); | ||
| return; | ||
|
|
@@ -663,4 +660,81 @@ public static int checkedCast(long value) { | |
| } | ||
| return (int) value; | ||
| } | ||
|
|
||
| /** Return true if the content of the files are equal or they both don't exist */ | ||
| public static boolean contentEquals(File file1, File file2) throws IOException { | ||
| if (file1 == null && file2 != null || file1 != null && file2 == null) { | ||
| return false; | ||
| } else if (file1 == null && file2 == null || !file1.exists() && !file2.exists()) { | ||
| return true; | ||
| } else if (!file1.exists() || !file2.exists()) { | ||
| return false; | ||
| } else if (file1.isDirectory() || file2.isDirectory()) { | ||
| throw new IllegalArgumentException("Input is not a file: %s or %s".formatted(file1, file2)); | ||
| } else if (file1.length() != file2.length()) { | ||
| return false; | ||
| } else { | ||
| Path path1 = file1.toPath(); | ||
| Path path2 = file2.toPath(); | ||
| return Files.isSameFile(path1, path2) || Files.mismatch(path1, path2) == -1L; | ||
| } | ||
| } | ||
|
|
||
| public static String toString(InputStream in) throws IOException { | ||
| return new String(in.readAllBytes(), StandardCharsets.UTF_8); | ||
| } | ||
|
|
||
| /** | ||
| * Indicates whether Spark is currently running unit tests. | ||
| */ | ||
| public static boolean isTesting() { | ||
| return System.getenv("SPARK_TESTING") != null || System.getProperty("spark.testing") != null; | ||
| } | ||
|
|
||
| /** | ||
| * The `os.name` system property. | ||
| */ | ||
| public static String osName = System.getProperty("os.name"); | ||
|
|
||
| /** | ||
| * The `os.version` system property. | ||
| */ | ||
| public static String osVersion = System.getProperty("os.version"); | ||
|
|
||
| /** | ||
| * The `java.version` system property. | ||
| */ | ||
| public static String javaVersion = Runtime.version().toString(); | ||
|
|
||
| /** | ||
| * The `os.arch` system property. | ||
| */ | ||
| public static String osArch = System.getProperty("os.arch"); | ||
|
|
||
| /** | ||
| * Whether the underlying operating system is Windows. | ||
| */ | ||
| public static boolean isWindows = osName.regionMatches(true, 0, "Windows", 0, 7); | ||
|
|
||
| /** | ||
| * Whether the underlying operating system is Mac OS X. | ||
| */ | ||
| public static boolean isMac = osName.regionMatches(true, 0, "Mac OS X", 0, 8); | ||
|
|
||
| /** | ||
| * Whether the underlying operating system is Mac OS X and processor is Apple Silicon. | ||
| */ | ||
| public static boolean isMacOnAppleSilicon = isMac && osArch.equals("aarch64"); | ||
|
|
||
| /** | ||
| * Whether the underlying operating system is Linux. | ||
| */ | ||
| public static boolean isLinux = osName.regionMatches(true, 0, "Linux", 0, 5); | ||
|
|
||
| /** | ||
| * Whether the underlying operating system is UNIX. | ||
| */ | ||
| public static boolean isUnix = Stream.of("AIX", "HP-UX", "Irix", "Linux", "Mac OS X", "Solaris", | ||
| "SunOS", "FreeBSD", "OpenBSD", "NetBSD") | ||
| .anyMatch(prefix -> osName.regionMatches(true, 0, prefix, 0, prefix.length())); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if the style is right here |
||
| } | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar changes should be incorporated into the maven_test.yml file. Meanwhile, both of these files should be utilized for the daily tests of branch-4.0/3.5. It is necessary to consider compatibility issues arising from the absence of certain modules in the relevant branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems branch-3.5 does not have the Maven daily test, I changed
maven_test.ymlin 21c892f99bcac44b28038ab1a0fd1034d09d3bc4, please help check.