输入'ROW'不匹配,在创建hive表时期望<eof>错误

时间:2015-08-05 06:38:20

标签: java hadoop hive presto

我正在尝试使用java创建一个hive表。

这是我的代码:

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.DriverManager;
public class HiveCreateTable {
   private static String driverName = "com.facebook.presto.jdbc.PrestoDriver";

   public static void main(String[] args) throws SQLException {

      // Register driver and create driver instance
      try {
        Class.forName(driverName);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
      System.out.println("haiiiiii");
      Connection con =  DriverManager.getConnection("jdbc:presto://192.168.1.100:8023", "", "");
      con.setCatalog("hive");
      con.setSchema("log");
      Statement stmt = con.createStatement();
      ResultSet res = stmt.executeQuery("create table access_log (c_ip  varchar,cs_username varchar,cs_computername varchar,cs_date     varchar,cs_code varchar,cs_method varchar,cs_uri_stem   varchar,cs_uri_query varchar,cs_status_code varchar,cs_bytes varchar)   ROW FORMAT DELIMITED FIELDS     TERMINATED BY '\b'LINES TERMINATED BY   '\n'STORED AS TEXTFILE");
      System.out.println("Table access_log4 created.");
    ResultSet res1 = stmt.executeQuery("LOAD DATA LOCAL INPATH  '/home/hadoop/access_log.txt'" + "OVERWRITE INTO TABLE access_log4;");
      System.out.println("data loaded to access_log4.");
    con.close();
   }
}

并收到以下错误:

  

线程“main”中的异常java.sql.SQLException:查询失败   (#20150805_063004_00002_3dvaz):第1:214行:不匹配的输入'ROW'   期待

如果我们删除“'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

0 个答案:

没有答案