huaxingao commented on code in PR #12494: URL: https://github.com/apache/iceberg/pull/12494#discussion_r2040876801
########## spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java: ########## @@ -875,7 +875,13 @@ private static void deleteManifests(FileIO io, List<ManifestFile> manifests) { public static Dataset<Row> loadTable(SparkSession spark, Table table, long snapshotId) { SparkTable sparkTable = new SparkTable(table, snapshotId, false); DataSourceV2Relation relation = createRelation(sparkTable, ImmutableMap.of()); - return Dataset.ofRows(spark, relation); + if (!(spark instanceof org.apache.spark.sql.classic.SparkSession)) { Review Comment: Spark 4.0 has [abstract class SparkSession](https://github.com/apache/spark/blob/master/sql/api/src/main/scala/org/apache/spark/sql/SparkSession.scala#L63) and [classic.SparkSession](https://github.com/apache/spark/blob/master/sql/api/src/main/scala/org/apache/spark/sql/SparkSession.scala#L63). We will always try to use the general one, and only cast to `classic.SparkSession` when the private APIs are needed. The same rule applies to `Dataset` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org