为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:
[TiDB 版本]
TIDB 5.0.1
[问题描述]
本地开发运行时缺少 TiCompositeSessionCatalog 请问这个该如何修改
def main(args: Array[String]): Unit = {
//System.setProperty(“hadoop.home.dir”, “D:\java\hadoop\hadoop-2.7.1\bin\winutils.exe”)
val sparkConf = new SparkConf()
.setIfMissing(“spark.master”, “spark://192.168.0.221:7077”)
.setIfMissing(“spark.app.name”, getClass.getName)
.setIfMissing(“spark.sql.runSQLOnFiles”,“true”)
.setIfMissing(“spark.sql.extensions”, “org.apache.spark.sql.TiExtensions”)
.setIfMissing(“spark.tispark.pd.addresses”, “192.168.0.222:2379,192.168.0.223:2379,192.168.0.224:2379”)
val spark = SparkSession.builder()
.config(sparkConf)
.getOrCreate();
spark.sql(“show databases”).show();
spark.sql(“use test”);
spark.sql(“select count(*) from test”).show();
spark.close();
}
报错:
21/05/05 18:08:18 INFO ReflectionUtil$: tispark class url: file:/D:/java/maven/repository/com/pingcap/tispark/tispark-core-internal/2.4.0/tispark-core-internal-2.4.0.jar
21/05/05 18:08:18 INFO ReflectionUtil$: spark wrapper class url: jar:file:/D:/java/maven/repository/com/pingcap/tispark/tispark-core-internal/2.4.0/tispark-core-internal-2.4.0.jar!/resources/spark-wrapper-spark-2_4/
Exception in thread “main” java.lang.ClassNotFoundException: org.apache.spark.sql.catalyst.catalog.TiCompositeSessionCatalog
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.pingcap.tispark.utils.ReflectionUtil$.newTiCompositeSessionCatalog(ReflectionUtil.scala:108)
at org.apache.spark.sql.TiContext.tiCatalog$lzycompute(TiContext.scala:49)
at org.apache.spark.sql.TiContext.tiCatalog(TiContext.scala:49)
at org.apache.spark.sql.execution.command.TiCommand.tiCatalog(TiCommand.scala:30)
at org.apache.spark.sql.execution.command.TiShowDatabasesCommand.run(databases.scala:44)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:79)
at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:194)
at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:194)
at org.apache.spark.sql.Dataset$$anonfun$52.apply(Dataset.scala:3370)
at org.apache.spark.sql.execution.SQLExecution$$anonfun$withNewExecutionId$1.apply(SQLExecution.scala:80)
at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:127)
at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:75)
at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$withAction(Dataset.scala:3369)
at org.apache.spark.sql.Dataset.(Dataset.scala:194)
at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:79)
at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:643)
at com.dgh.hzf.test$.main(test.scala:25)
at com.dgh.hzf.test.main(test.scala)
若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。