nastra commented on code in PR #11758: URL: https://github.com/apache/iceberg/pull/11758#discussion_r1917947036
########## spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/SparkQueryRunner.java: ########## @@ -0,0 +1,78 @@ +/* + * 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.iceberg.spark; + +import static org.apache.hadoop.hive.conf.HiveConf.ConfVars.METASTOREURIS; +import static org.apache.iceberg.spark.SparkTestHelperBase.rowsToJava; + +import java.util.List; +import java.util.Scanner; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.iceberg.hive.TestHiveMetastore; +import org.apache.iceberg.relocated.com.google.common.base.Joiner; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.apache.spark.sql.internal.SQLConf; + +/** + * When you start the main method, it launches a spark-sql> prompt. At the prompt, you can enter a + * line of SQL, which will then be executed, and the result will be displayed. If you want to debug + * the code, you can set breakpoints in your IDE. + */ +public final class SparkQueryRunner { + private static final Joiner JOIN = Joiner.on("|"); + + private SparkQueryRunner() {} + + public static void main(String[] args) throws Exception { Review Comment: ``` Exception in thread "main" java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x3dfada53) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x3dfada53 at org.apache.spark.storage.StorageUtils$.<init>(StorageUtils.scala:213) at org.apache.spark.storage.StorageUtils$.<clinit>(StorageUtils.scala) at org.apache.spark.storage.BlockManagerMasterEndpoint.<init>(BlockManagerMasterEndpoint.scala:121) at org.apache.spark.SparkEnv$.$anonfun$create$9(SparkEnv.scala:353) at org.apache.spark.SparkEnv$.registerOrLookupEndpoint$1(SparkEnv.scala:290) at org.apache.spark.SparkEnv$.create(SparkEnv.scala:339) at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:194) at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:284) at org.apache.spark.SparkContext.<init>(SparkContext.scala:478) at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2883) at org.apache.spark.sql.SparkSession$Builder.$anonfun$getOrCreate$2(SparkSession.scala:1099) at scala.Option.getOrElse(Option.scala:189) at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:1093) at org.apache.iceberg.spark.SparkQueryRunner.main(SparkQueryRunner.java:57) ``` This is what I get when starting this with JDK17. We'll need to document which `--add-opens` flags need to be added. In my case adding `--add-opens java.base/sun.nio.ch=ALL-UNNAMED` as a VM argument when executing this made it work. Can you please document that so that others don't have to search/hunt down what configuration is required when starting this? -- 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