Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ trait VeloxFormatWriterInjects extends GlutenFormatWriterInjectsBase {
datasourceJniWrapper.close(dsHandle)
}

// Do NOT add override keyword for compatibility on spark 3.1.
def path(): String = {
override def path(): String = {
filePath
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.vectorized.ColumnVector

/**
* Because Spark-3.2 declares ColumnarBatch as final, so `ArrowColumnarBatch` can't extend
* `ColumnarBatch`. The code is mainly copied from Spark-3.2
* A `ColumnarBatch`-like container of [[ArrowWritableColumnVector]]s. Originally forked from
* Spark's `ColumnarBatch` before Gluten could depend on that class directly; it is kept as a
* standalone class rather than extending `ColumnarBatch` to preserve the writable-column contract
* and existing call sites.
*
* @param writableColumns
* the columns this class wraps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ public <K, V> ShuffleWriter<K, V> getWriter(
}
}

// Added in SPARK-32055, for Spark 3.1 and above
public <K, C> ShuffleReader<K, C> getReader(
ShuffleHandle handle,
int startMapIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ object WriteFilesExecTransformer {
.toLowerCase(Locale.ROOT)
}

// To be compatible with Spark3.2/3.3/3.4, we do cleanup spark internal metadata manually.
// To be compatible with Spark 3.3/3.4, we clean up Spark internal metadata manually.
// Spark 3.5 already strips these fields via SPARK-43123.
// See https://github.com/apache/spark/pull/40776
private val INTERNAL_METADATA_KEYS = Seq(
"__autoGeneratedAlias",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,12 @@
*/
package org.apache.gluten.integration;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.spark.launcher.JavaModuleOptions;

public class SparkJvmOptions {
private static final String MODULE_OPTIONS_CLASS_NAME =
"org.apache.spark.launcher.JavaModuleOptions";

public static String read() {
try {
final Class<?> clazz = Class.forName(MODULE_OPTIONS_CLASS_NAME);
final Method method = clazz.getMethod("defaultModuleOptions");
return (String) method.invoke(null);
} catch (ClassNotFoundException
| NoSuchMethodException
| InvocationTargetException
| IllegalAccessException e) {
throw new RuntimeException(
"Failed to read Spark JVM module options via "
+ MODULE_OPTIONS_CLASS_NAME
+ "#defaultModuleOptions",
e);
}
return JavaModuleOptions.defaultModuleOptions();
}
Comment on lines 23 to 25

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note. I don't think a guard is worth adding here:

  • spark-launcher is a compile-scope dep of spark-core on every currently supported branch (Spark 3.3 through 4.1), so JavaModuleOptions will always be on the classpath at runtime.
  • The only caller is tools/gluten-it/sbin/gluten-it.sh, which runs SparkJvmOptions against the package/target/lib directory containing the full Gluten + Spark jars — the same classpath every Gluten job uses.

A guard would trade a standard JVM linkage error for a slightly nicer message in a scenario that has no realistic way to occur; every other Gluten module already calls Spark APIs directly and would fail earlier under a hypothetical missing-spark-core setup. I'd rather match that convention.


public static void main(String[] args) {
Expand Down
Loading