This is an automated email from the ASF dual-hosted git repository.
hongze pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new ffe2be63f [CORE] Minor code cleanup for package object of
`org.apache.gluten` (#7231)
ffe2be63f is described below
commit ffe2be63f7d9dcc4da15992662ed4f76da3f6f36
Author: Hongze Zhang <[email protected]>
AuthorDate: Sat Sep 14 07:58:12 2024 +0800
[CORE] Minor code cleanup for package object of `org.apache.gluten` (#7231)
---
.../gluten/backendsapi/clickhouse/CHBackend.scala | 5 +-
.../gluten/backendsapi/velox/VeloxBackend.scala | 3 +-
.../scala/org/apache/gluten/GlutenBuildInfo.scala | 60 +++++++++++++++++
.../scala/org/apache/gluten/GlutenPlugin.scala | 1 +
.../src/main/scala/org/apache/gluten/gluten.scala | 78 ----------------------
.../execution/WholeStageTransformerSuite.scala | 1 +
.../spark/sql/gluten/GlutenFallbackSuite.scala | 9 ++-
.../spark/sql/gluten/GlutenFallbackSuite.scala | 9 ++-
.../spark/sql/gluten/GlutenFallbackSuite.scala | 9 ++-
9 files changed, 88 insertions(+), 87 deletions(-)
diff --git
a/backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala
b/backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala
index 9fd66b473..b99ccb9bc 100644
---
a/backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala
+++
b/backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala
@@ -16,7 +16,8 @@
*/
package org.apache.gluten.backendsapi.clickhouse
-import org.apache.gluten.{CH_BRANCH, CH_COMMIT, GlutenConfig}
+import org.apache.gluten.GlutenBuildInfo._
+import org.apache.gluten.GlutenConfig
import org.apache.gluten.backend.Backend
import org.apache.gluten.backendsapi._
import org.apache.gluten.execution.WriteFilesExecTransformer
@@ -39,7 +40,7 @@ import org.apache.spark.sql.execution.datasources.FileFormat
import org.apache.spark.sql.execution.datasources.orc.OrcFileFormat
import org.apache.spark.sql.execution.datasources.parquet.ParquetFileFormat
import org.apache.spark.sql.internal.SQLConf
-import org.apache.spark.sql.types.{ArrayType, MapType, Metadata, StructField,
StructType}
+import org.apache.spark.sql.types._
import java.util.Locale
diff --git
a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
index 19985d6b8..a70bab8ae 100644
---
a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
+++
b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
@@ -16,7 +16,8 @@
*/
package org.apache.gluten.backendsapi.velox
-import org.apache.gluten.{GlutenConfig, VELOX_BRANCH, VELOX_REVISION,
VELOX_REVISION_TIME}
+import org.apache.gluten.GlutenBuildInfo._
+import org.apache.gluten.GlutenConfig
import org.apache.gluten.backend.Backend
import org.apache.gluten.backendsapi._
import org.apache.gluten.exception.GlutenNotSupportException
diff --git a/gluten-core/src/main/scala/org/apache/gluten/GlutenBuildInfo.scala
b/gluten-core/src/main/scala/org/apache/gluten/GlutenBuildInfo.scala
new file mode 100644
index 000000000..96b616251
--- /dev/null
+++ b/gluten-core/src/main/scala/org/apache/gluten/GlutenBuildInfo.scala
@@ -0,0 +1,60 @@
+/*
+ * 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.gluten
+
+import org.apache.gluten.exception.GlutenException
+
+import java.util.Properties
+
+import scala.util.Try
+
+/** Since https://github.com/apache/incubator-gluten/pull/1973. */
+object GlutenBuildInfo {
+ private val buildFile = "gluten-build-info.properties"
+ private val buildFileStream =
+ Thread.currentThread().getContextClassLoader.getResourceAsStream(buildFile)
+
+ if (buildFileStream == null) {
+ throw new GlutenException(s"Can not load the core build file: $buildFile")
+ }
+
+ val unknown = "<unknown>"
+ private val props = new Properties()
+
+ try {
+ props.load(buildFileStream)
+ } finally {
+ Try(buildFileStream.close())
+ }
+
+ val VERSION: String = props.getProperty("gluten_version", unknown)
+ val GCC_VERSION: String = props.getProperty("gcc_version", unknown)
+ val JAVA_COMPILE_VERSION: String = props.getProperty("java_version", unknown)
+ val SCALA_COMPILE_VERSION: String = props.getProperty("scala_version",
unknown)
+ val SPARK_COMPILE_VERSION: String = props.getProperty("spark_version",
unknown)
+ val HADOOP_COMPILE_VERSION: String = props.getProperty("hadoop_version",
unknown)
+ val BRANCH: String = props.getProperty("branch", unknown)
+ val REVISION: String = props.getProperty("revision", unknown)
+ val REVISION_TIME: String = props.getProperty("revision_time", unknown)
+ val BUILD_DATE: String = props.getProperty("date", unknown)
+ val REPO_URL: String = props.getProperty("url", unknown)
+ val VELOX_BRANCH: String = props.getProperty("velox_branch", unknown)
+ val VELOX_REVISION: String = props.getProperty("velox_revision", unknown)
+ val VELOX_REVISION_TIME: String = props.getProperty("velox_revision_time",
unknown)
+ val CH_BRANCH: String = props.getProperty("ch_branch", unknown)
+ val CH_COMMIT: String = props.getProperty("ch_commit", unknown)
+}
diff --git a/gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala
b/gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala
index 72998c0b0..b7cb3294a 100644
--- a/gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala
+++ b/gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala
@@ -16,6 +16,7 @@
*/
package org.apache.gluten
+import org.apache.gluten.GlutenBuildInfo._
import org.apache.gluten.GlutenConfig.GLUTEN_DEFAULT_SESSION_TIMEZONE_KEY
import org.apache.gluten.backend.Backend
import org.apache.gluten.events.GlutenBuildInfoEvent
diff --git a/gluten-core/src/main/scala/org/apache/gluten/gluten.scala
b/gluten-core/src/main/scala/org/apache/gluten/gluten.scala
deleted file mode 100644
index 4659bd6b0..000000000
--- a/gluten-core/src/main/scala/org/apache/gluten/gluten.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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
-
-import org.apache.gluten.exception.GlutenException
-
-import java.util.Properties
-
-import scala.util.Try
-
-package object gluten {
- protected object BuildInfo {
- private val buildFile = "gluten-build-info.properties"
- private val buildFileStream =
-
Thread.currentThread().getContextClassLoader.getResourceAsStream(buildFile)
-
- if (buildFileStream == null) {
- throw new GlutenException(s"Can not load the core build file:
$buildFile")
- }
-
- val unknown = "<unknown>"
- private val props = new Properties()
-
- try {
- props.load(buildFileStream)
- } finally {
- Try(buildFileStream.close())
- }
-
- val version: String = props.getProperty("gluten_version", unknown)
- val gccVersion: String = props.getProperty("gcc_version", unknown)
- val javaVersion: String = props.getProperty("java_version", unknown)
- val scalaVersion: String = props.getProperty("scala_version", unknown)
- val sparkVersion: String = props.getProperty("spark_version", unknown)
- val hadoopVersion: String = props.getProperty("hadoop_version", unknown)
- val branch: String = props.getProperty("branch", unknown)
- val revision: String = props.getProperty("revision", unknown)
- val revisionTime: String = props.getProperty("revision_time", unknown)
- val buildDate: String = props.getProperty("date", unknown)
- val repoUrl: String = props.getProperty("url", unknown)
- val veloxBranch: String = props.getProperty("velox_branch", unknown)
- val veloxRevision: String = props.getProperty("velox_revision", unknown)
- val veloxRevisionTime: String = props.getProperty("velox_revision_time",
unknown)
- val chBranch: String = props.getProperty("ch_branch", unknown)
- val chCommit: String = props.getProperty("ch_commit", unknown)
- }
-
- val VERSION: String = BuildInfo.version
- val GCC_VERSION: String = BuildInfo.gccVersion
- val JAVA_COMPILE_VERSION: String = BuildInfo.javaVersion
- val SCALA_COMPILE_VERSION: String = BuildInfo.scalaVersion
- val SPARK_COMPILE_VERSION: String = BuildInfo.sparkVersion
- val HADOOP_COMPILE_VERSION: String = BuildInfo.hadoopVersion
- val BRANCH: String = BuildInfo.branch
- val REVISION: String = BuildInfo.revision
- val REVISION_TIME: String = BuildInfo.revisionTime
- val BUILD_DATE: String = BuildInfo.buildDate
- val REPO_URL: String = BuildInfo.repoUrl
- val VELOX_BRANCH: String = BuildInfo.veloxBranch
- val VELOX_REVISION: String = BuildInfo.veloxRevision
- val VELOX_REVISION_TIME: String = BuildInfo.veloxRevisionTime
- val CH_BRANCH: String = BuildInfo.chBranch
- val CH_COMMIT: String = BuildInfo.chCommit
-}
diff --git
a/gluten-substrait/src/test/scala/org/apache/gluten/execution/WholeStageTransformerSuite.scala
b/gluten-substrait/src/test/scala/org/apache/gluten/execution/WholeStageTransformerSuite.scala
index 95391a2c4..1e06aea67 100644
---
a/gluten-substrait/src/test/scala/org/apache/gluten/execution/WholeStageTransformerSuite.scala
+++
b/gluten-substrait/src/test/scala/org/apache/gluten/execution/WholeStageTransformerSuite.scala
@@ -316,6 +316,7 @@ abstract class WholeStageTransformerSuite
}
}
checkDataFrame(noFallBack, customCheck, df)
+ df.explain(true)
df
}
diff --git
a/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
b/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
index e724cf31c..c2446e38d 100644
---
a/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
+++
b/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
@@ -16,7 +16,7 @@
*/
package org.apache.spark.sql.gluten
-import org.apache.gluten.{GlutenConfig, VERSION}
+import org.apache.gluten.{GlutenBuildInfo, GlutenConfig}
import org.apache.gluten.events.GlutenPlanFallbackEvent
import org.apache.gluten.execution.FileSourceScanExecTransformer
import org.apache.gluten.utils.BackendTestUtils
@@ -53,7 +53,12 @@ class GlutenFallbackSuite extends GlutenSQLTestsTrait with
AdaptiveSparkPlanHelp
testGluten("test fallback event") {
val kvStore =
spark.sparkContext.statusStore.store.asInstanceOf[ElementTrackingStore]
val glutenStore = new GlutenSQLAppStatusStore(kvStore)
- assert(glutenStore.buildInfo().info.find(_._1 == "Gluten
Version").exists(_._2 == VERSION))
+ assert(
+ glutenStore
+ .buildInfo()
+ .info
+ .find(_._1 == "Gluten Version")
+ .exists(_._2 == GlutenBuildInfo.VERSION))
def runExecution(sqlString: String): Long = {
var id = 0L
diff --git
a/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
b/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
index fd6aa0475..d7ec1f0fa 100644
---
a/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
+++
b/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
@@ -16,7 +16,7 @@
*/
package org.apache.spark.sql.gluten
-import org.apache.gluten.{GlutenConfig, VERSION}
+import org.apache.gluten.{GlutenBuildInfo, GlutenConfig}
import org.apache.gluten.events.GlutenPlanFallbackEvent
import org.apache.gluten.execution.FileSourceScanExecTransformer
import org.apache.gluten.utils.BackendTestUtils
@@ -55,7 +55,12 @@ class GlutenFallbackSuite extends GlutenSQLTestsTrait with
AdaptiveSparkPlanHelp
testGluten("test fallback event") {
val kvStore =
spark.sparkContext.statusStore.store.asInstanceOf[ElementTrackingStore]
val glutenStore = new GlutenSQLAppStatusStore(kvStore)
- assert(glutenStore.buildInfo().info.find(_._1 == "Gluten
Version").exists(_._2 == VERSION))
+ assert(
+ glutenStore
+ .buildInfo()
+ .info
+ .find(_._1 == "Gluten Version")
+ .exists(_._2 == GlutenBuildInfo.VERSION))
def runExecution(sqlString: String): Long = {
var id = 0L
diff --git
a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
index fd6aa0475..d7ec1f0fa 100644
---
a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
+++
b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/gluten/GlutenFallbackSuite.scala
@@ -16,7 +16,7 @@
*/
package org.apache.spark.sql.gluten
-import org.apache.gluten.{GlutenConfig, VERSION}
+import org.apache.gluten.{GlutenBuildInfo, GlutenConfig}
import org.apache.gluten.events.GlutenPlanFallbackEvent
import org.apache.gluten.execution.FileSourceScanExecTransformer
import org.apache.gluten.utils.BackendTestUtils
@@ -55,7 +55,12 @@ class GlutenFallbackSuite extends GlutenSQLTestsTrait with
AdaptiveSparkPlanHelp
testGluten("test fallback event") {
val kvStore =
spark.sparkContext.statusStore.store.asInstanceOf[ElementTrackingStore]
val glutenStore = new GlutenSQLAppStatusStore(kvStore)
- assert(glutenStore.buildInfo().info.find(_._1 == "Gluten
Version").exists(_._2 == VERSION))
+ assert(
+ glutenStore
+ .buildInfo()
+ .info
+ .find(_._1 == "Gluten Version")
+ .exists(_._2 == GlutenBuildInfo.VERSION))
def runExecution(sqlString: String): Long = {
var id = 0L
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]