2017-12-30 27 views
1

私はcsvから寄木細工のファイルを作りました。Zeppelinが「不一致の入力」で失敗するのはなぜですか? <EOF> "%spark.sqlの段落で期待していますか?

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 

私は問題を理解していない:私はエラーを取得した結果

%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") 

はツェッペリンでは、私のようなSQL文を作成しました。 csvは '、'で区切られていました。

誰でも私を助けてくれますか?

答えて

0

Zeppelinでparagraph(別名コードセクション)の%spark.sqlにある1つのSQL文を使用してください。

ので、1つの段落で、この1行:

DROP TABLE IF EXISTS df; 

、別の%spark.sql段落内の1。 (SparkSQLInterpreter経由)

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.sqlprovides a SQL environment using Spark SQL

私は間違えじゃない場合は、結果SparkSQLInterpreterのために要求されたときに、単にSQLContext.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); 

「実行環境」としてSQLContext.sqlで指しています。

​​

sqlには、単一のSQL文が必要です。

関連する問題