hive -hiveconf -f xxx.sql错误

时间:2016-09-29 07:01:51

标签: sql hive

我的sql文件内容是:

CREATE EXTERNAL TABlE  unLock(logTime TIMESTAMP, ystID STRING,deviceID STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'
WITH SERDEPROPERTIES ("field.delim"="$$")
STORED AS TEXTFILE
LOCATION concat(hdfs://hadoop1:9000/logHive/unLock/,${hiveconf:logdir});

我的shell脚本文件内容是:

hive -hiveconf logdir="$(date +'%Y/%m/%d/')" -f /home/yst/create.sql

当我在cmd中运行shell文件时,错误是:

FAILED: ParseException line 7:9 mismatched input 'concat' expecting StringLiteral near 'LOCATION' in table location specification

我不知道为什么。我只想要hive表的位置是当天的文件。

1 个答案:

答案 0 :(得分:1)

尚未测试,但这可能有效:

new Thread(new Runnable() { @Override public void run() { try { //URL url = new URL("http://192.168.2.5:5213/controller/moodoff/notifications/9681578989"); URL url = new URL("http://echo.jsontest.com/key/value/one/two"); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); InputStream is = urlConnection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); int data = isr.read(); StringBuilder response = new StringBuilder(""); if(data!=-1){ response.append((char)data); data = isr.read(); } Log.i("TAG","Response:="+response.toString()); //allNotifications.setText("Hi:"+response.toString()); }catch(Exception ee){allNotifications.setText(ee.getMessage());ee.printStackTrace();} } }).start();