Apache spark 齐柏林飞艇为什么会失败;输入不匹配'';期待<;EOF>&引用;在%spark.sql段中?

Apache spark 齐柏林飞艇为什么会失败;输入不匹配'';期待<;EOF>&引用;在%spark.sql段中?,apache-spark,apache-spark-sql,parquet,apache-zeppelin,Apache Spark,Apache Spark Sql,Parquet,Apache Zeppelin,我已经建立了一个拼花文件从csv 在齐柏林飞艇中,我创建了一个sql语句,如: %spark.sql DROP TABLE IF EXISTS df; CREATE TABLE df ( date_time STRING , site_name STRING , posa_continent STRING , user_location_country STRING , user_location_region STRING , user_location_city

我已经建立了一个拼花文件从csv

在齐柏林飞艇中,我创建了一个sql语句,如:

%spark.sql
DROP TABLE IF EXISTS df;
CREATE TABLE df (
    date_time STRING
  , site_name STRING
  , posa_continent STRING
  , user_location_country STRING
  , user_location_region STRING
  , user_location_city STRING
  , orig_destination_distance DOUBLE
  , user_id STRING
  , is_mobile STRING
  , is_package STRING
  , channel STRING
  , srch_ci STRING
  , srch_co STRING
  , srch_adults_cnt INT 
  , srch_children_cnt INT
  , srch_rm_cnt INT
  , srch_destination_id STRING
  , srch_destination_type_id STRING
  , is_booking STRING
  , cnt INT
  , hotel_continentm STRING
  , hotel_country STRING
  , hotel_market STRING
  , hotel_cluster STRING)
USING parquet
OPTIONS (path "s3://hansprojekt/training_17000000pq")
结果我得到一个错误:

mismatched input ';' expecting <EOF>(line 1, pos 23)
== SQL ==
DROP TABLE IF EXISTS df;
-----------------------^^^
CREATE TABLE df (
    date_time STRING
  , site_name STRING
  , posa_continent STRING
  , user_location_country STRING
  , user_location_region STRING
  , user_location_city STRING
  , orig_destination_distance DOUBLE
  , user_id STRING
  , is_mobile STRING
  , is_package STRING
  , channel STRING
  , srch_ci STRING
  , srch_co STRING
  , srch_adults_cnt INT 
  , srch_children_cnt INT
  , srch_rm_cnt INT
  , srch_destination_id STRING
  , srch_destination_type_id STRING
  , is_booking STRING
  , cnt INT
  , hotel_continent STRING
  , hotel_country STRING
  , hotel_market STRING
  , hotel_cluster STRING)
USING parquet
OPTIONS (path "s3://hansprojekt/training_17000000pq")
set zeppelin.spark.sql.stacktrace = true to see full stacktrace
输入不匹配“;”预期(第1行,位置23)
==SQL==
如果存在df,则删除表格;
-----------------------^^^
创建表df(
日期/时间字符串
,站点名称字符串
,posa_大陆弦
,用户\位置\国家/地区字符串
,用户\位置\区域字符串
,用户\位置\城市字符串
,起点\终点\距离加倍
,用户id字符串
,是移动字符串
,是_包字符串
,频道串
,srch_ci字符串
,srch_co字符串
,srch_成人_cnt INT
,srch_children_cnt INT
,srch_rm_cnt INT
,srch_destination_id字符串
,srch\u destination\u type\u id字符串
,是预订字符串吗
,cnt INT
欧洲大陆弦酒店
乡村弦酒店
,市集酒店
,酒店(串)
使用拼花地板
选项(路径“s3://hansprojekt/training_17000000pq”)
设置zeppelin.spark.sql.stacktrace=true以查看完整的stacktrace
我不明白这个问题。csv用“,”分隔


有人能帮我吗?

在齐柏林飞艇的
%spark.SQL
中的(又名代码部分)使用一条SQL语句

因此,一段中的这一行:

DROP TABLE IF EXISTS df;
还有另一段
%spark.sql
中的一段

CREATE TABLE df (
    date_time STRING
  , site_name STRING
  , posa_continent STRING
  , user_location_country STRING
  , user_location_region STRING
  , user_location_city STRING
  , orig_destination_distance DOUBLE
  , user_id STRING
  , is_mobile STRING
  , is_package STRING
  , channel STRING
  , srch_ci STRING
  , srch_co STRING
  , srch_adults_cnt INT 
  , srch_children_cnt INT
  , srch_rm_cnt INT
  , srch_destination_id STRING
  , srch_destination_type_id STRING
  , is_booking STRING
  , cnt INT
  , hotel_continentm STRING
  , hotel_country STRING
  , hotel_market STRING
  , hotel_cluster STRING)
USING parquet
OPTIONS (path "s3://hansprojekt/training_17000000pq")

%spark.sql
(通过)

如果我没有弄错的话,当请求一个结果时,
SparkSqlTranslator
只执行:

这就指向了“执行环境”

sql(sqlText:String):DataFrame使用Spark执行sql查询,并将结果作为DataFrame返回

sql
需要一条sql语句

  // method signature of sqlc.sql() is changed
  // from  def sql(sqlText: String): SchemaRDD (1.2 and prior)
  // to    def sql(sqlText: String): DataFrame (1.3 and later).
  // Therefore need to use reflection to keep binary compatibility for all spark versions.
  Method sqlMethod = sqlc.getClass().getMethod("sql", String.class);
  rdd = sqlMethod.invoke(sqlc, st);