简体   繁体   English

具有Java错误的Apache Zeppelin:“;” 预期但找到“班级”

[英]Apache Zeppelin with Java error: ';' expected but 'class' found

I use Apache Spark's Java API to load data from some sources(like Cassandra and HDFS) for visualization in Apache Zeppelin. 我使用Apache Spark的Java API从某些源(例如Cassandra和HDFS)加载数据,以便在Apache Zeppelin中进行可视化。 The code is using SparkSql and SparkSession , not SparkContext and tested successfully in IDE. 该代码使用的是SparkSqlSparkSession ,而不是SparkContext并且已在IDE中成功测试。 I paste the full code (containing all codes that I run in IDE) into Zeppelin notebook and after running it through an error error: ';' expected but 'class' found 我将完整代码(包含我在IDE中运行的所有代码)粘贴到Zeppelin笔记本中,并通过错误error: ';' expected but 'class' found运行它error: ';' expected but 'class' found error: ';' expected but 'class' found . error: ';' expected but 'class' found I think this error is a Scala error and I suspect does Zeppelin support Spark Java API?! 我认为此错误是Scala错误,我怀疑Zeppelin是否支持Spark Java API? If yes, how can I solve the problem? 是,如何解决?

Apache Zeppelin version: 0.7.3 The following is the code: Apache Zeppelin版本: 0.7.3下面是代码:

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import java.util.HashMap;

public class LoadCSV {
    public static void main(String[] args) {
        HashMap<String, String> ops = new HashMap();
        ops.put("table", "grades");
        ops.put("keyspace", "zeppline");

        SparkSession spark = SparkSession
                .builder()
                .master("local[*]")
                .appName("Java Spark SQL basic example")
                .config("spark.cassandra.connection.host", "127.0.0.1")
                .config("spark.cassandra.connection.port", "9042")
                .getOrCreate();

        Dataset<Row> df1 = spark.read()
                .format("csv")
                .option("header", true)
                .option("inferSchema", true)
                .csv("hdfs://localhost:54310/Data/Zeppline/grades.csv");


        Dataset<Row> df2 = spark.read()
                .format("org.apache.spark.sql.cassandra")
                .options(ops)
                .load()
                .select("id","first_name", "last_name", "ssn", "test1", "test2", "test3", "test4", "final", "grade");

        df1.union(df2).createOrReplaceTempView("grades");

    }
}

I suspect does Zeppelin support Spark JAVA API? 我怀疑齐柏林飞艇是否支持Spark JAVA API?

It does not. 它不是。 You can fin a full list of avialable interpreters on the Zeppelin website ( https://zeppelin.apache.org/docs/latest/manual/interpreters.html ) and there is no Java interpreter there. 您可以在Zeppelin网站( https://zeppelin.apache.org/docs/latest/manual/interpreters.html )上找到可用的解释器的完整列表,并且那里没有Java解释器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java错误:找到了接口......但是预期了类 - Java error: Found interface … but class was expected oozie抛出错误java.lang.IncompatibleClassChangeError:找到了接口org.apache.hadoop.mapreduce.Counter,但是期望使用类 - oozie throwing error java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.Counter, but class was expected Java错误“ .class预期” - java error “.class expected” Java&#39;.class&#39;预期错误 - Java '.class' expected error Java错误-预期.class - Java error - .class expected Hadoop:java.lang.IncompatibleClassChangeError:找到接口org.apache.hadoop.mapreduce.JobContext,但是类是预期的 - Hadoop: java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected 错误:找到接口org.apache.hadoop.mapreduce.Counter,但预期使用类 - Error: Found interface org.apache.hadoop.mapreduce.Counter, but class was expected 我在上传文件时遇到问题,出现此错误:找到接口 org.apache.poi.util.POILogger,但预期为 class - I have a problem with uploading a file, with this error: Found interface org.apache.poi.util.POILogger, but class was expected 找到接口org.apache.poi.util.POILogger,但是class是预期错误 - Found interface org.apache.poi.util.POILogger, but class was expected error Java错误(找不到类) - java error (Class not found)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM