2017-12-30 71 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에있는 하나의 SQL 문을 사용하십시오.

그래서, 한 단락이 한 줄 :

DROP TABLE IF EXISTS df; 

다른 %spark.sql 단락의 하나.


%spark.sqlprovides a SQL environment using 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") 
( SparkSQLInterpreter 통해).

내가 하지 틀리지 경우, 결과 SparkSQLInterpreter를 요청하는 메시지가 나타나면 단순히 SQLContext.sql 실행 :

은 "실행 환경"으로 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); 

.

sql(sqlText: String): DataFrame Executes a SQL query using Spark, returning the result as a DataFrame.

sql에는 단일 SQL 문이 필요합니다.