sparksql报错

Posted mediocreworld

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sparksql报错相关的知识,希望对你有一定的参考价值。

执行时报错:

org.apache.spark.sql.AnalysisException: Unable to generate an encoder for inner class `cn.itcast.spark.sql.Intro$Person` without access to the scope that this class was defined in.
Try moving this class out of its parent class.;

解决方法:将case class Person(name:String,age:Int)这个样例类移动到父类的外面,就是移到最外面,不要让其包含任何的类中。

 

以上是关于sparksql报错的主要内容,如果未能解决你的问题,请参考以下文章

sparksql读取hive数据报错:java.lang.RuntimeException: serious problem

SparkSql报错——记java.io.IOException: Illegal type id 0. The valid range is 0 to -1报错

HiveSql&SparkSql—COUNT(DISTINCT ) OVER (PARTITION BY )报错解决方案

hivesql 迁移spark3.0 sparksql报错如Cannot safely cast '字段':StringType to IntegerType的问题

kettle连接sparksql

SparkSQL——通过JDBC的方式访问