Skip to content

Commit 7c5ad69

Browse files
committed
fix type cast warning in PolarisCatalogUtils
``` plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/utils/PolarisCatalogUtils.java:131: warning: [unchecked] unchecked cast scala.collection.immutable.Map$.MODULE$.apply( ^ required: Map<String,String> found: Map ```
1 parent 3b65e89 commit 7c5ad69

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/utils/PolarisCatalogUtils.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Utils;
4141
import org.apache.spark.sql.util.CaseInsensitiveStringMap;
4242
import scala.Option;
43+
import scala.Tuple2;
44+
import scala.collection.immutable.Map$;
45+
import scala.collection.mutable.Builder;
4346

4447
public class PolarisCatalogUtils {
4548

@@ -125,10 +128,10 @@ public static Table loadV1SparkTable(
125128
new TableIdentifier(
126129
identifier.name(), Option.apply(namespacePath), Option.apply(catalogName));
127130

128-
scala.collection.immutable.Map<String, String> scalaOptions =
129-
(scala.collection.immutable.Map<String, String>)
130-
scala.collection.immutable.Map$.MODULE$.apply(
131-
scala.collection.JavaConverters.mapAsScalaMap(tableProperties).toSeq());
131+
Builder<Tuple2<String, String>, scala.collection.immutable.Map<String, String>> mb =
132+
Map$.MODULE$.newBuilder();
133+
tableProperties.forEach((k, v) -> mb.$plus$eq(Tuple2.apply(k, v)));
134+
scala.collection.immutable.Map<String, String> scalaOptions = mb.result();
132135

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

0 commit comments

Comments
 (0)