Skip to content
Merged
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 @@ -40,6 +40,9 @@
import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Utils;
import org.apache.spark.sql.util.CaseInsensitiveStringMap;
import scala.Option;
import scala.Tuple2;
import scala.collection.immutable.Map$;
import scala.collection.mutable.Builder;

public class PolarisCatalogUtils {

Expand Down Expand Up @@ -125,10 +128,10 @@ public static Table loadV1SparkTable(
new TableIdentifier(
identifier.name(), Option.apply(namespacePath), Option.apply(catalogName));

scala.collection.immutable.Map<String, String> scalaOptions =
(scala.collection.immutable.Map<String, String>)
scala.collection.immutable.Map$.MODULE$.apply(
scala.collection.JavaConverters.mapAsScalaMap(tableProperties).toSeq());
Builder<Tuple2<String, String>, scala.collection.immutable.Map<String, String>> mb =
Map$.MODULE$.newBuilder();
tableProperties.forEach((k, v) -> mb.$plus$eq(Tuple2.apply(k, v)));
scala.collection.immutable.Map<String, String> scalaOptions = mb.result();
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about using scala.jdk.javaapi.CollectionConverters instead of the original builder pattern here (and JavaConverters on line 142)? It's more concise, though the builder approach is more explicit.

Copy link
Contributor Author

@dimas-b dimas-b Nov 28, 2025

Choose a reason for hiding this comment

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

I tried CollectionConverters but hit compatibility issues between scala 2.12 and 2.13 🤷

@tmater : if you have a working code for both scala versions that Polaris uses - please open a PR. I'd be happy to switch to CollectionConverters. Note: IJ by default only shows you scala 2.12 - you need to run ./gradlew --no-build-cache :polaris-spark-3.5_2.13:compileJava from shell.

Copy link
Contributor

@tmater tmater Nov 28, 2025

Choose a reason for hiding this comment

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

thank you for the explanation, I’ll check both Scala versions later today.


org.apache.spark.sql.catalyst.catalog.CatalogStorageFormat storage =
DataSource.buildStorageFormatFromOptions(scalaOptions);
Expand Down