hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gabriel balan <gabriel.ba...@oracle.com>
Subject Re: getting mismatched input 'ROW' expecting <EOF> error in hive creation
Date Tue, 04 Aug 2015 16:26:17 GMT
Hi
>  + "ROW  FORMAT DELIMITED FIELDS TERMINATED BY '\b' LINES TERMINATED BY '\n'");
Shouldn't you escape the backslashes ('\\n' instead of '\n'), so they're not interpreted by
java?

hth
GB


On 8/4/2015 11:22 AM, Sateesh Karuturi wrote:
> i want create a hive table using java code. my code is
> package com.inndata.services;/
> /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.118:8023", "hadoop",
"cassandra");
>    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'");
>    System.out.println("Table access_log created.");
>    con.close();
> }
> }
> and getting
> Exception in thread "main" java.sql.SQLException: Query failed (#20150804_152058_00004_r8ehs):
line 1:214: mismatched input 'ROW' expecting <EOF>

-- 
The statements and opinions expressed here are my own and do not necessarily represent those
of Oracle Corporation.


Mime
View raw message