|
|
-
Re: Cannot recognize input near..Aniket Mokashi 2011-12-26, 18:13
Hi,
I think you are missing the word "table" after "overwrite". Syntax- insert overwrite table month_tbl select .... https://cwiki.apache.org/confluence/display/Hive/GettingStarted Thanks, Aniket On Fri, Dec 23, 2011 at 9:10 AM, Periya.Data <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to run a simple query in my JDBC-Client java code: > > ============================================================> // create mon_tbl - Monthly aggregated data > String mon_tblName = "month_tbl"; > sql = "DROP TABLE IF EXISTS " + mon_tblName; > res = stmt.executeQuery(sql); > res = stmt.executeQuery("CREATE TABLE " + mon_tblName + " (ServerIP > STRING, Month INT, BytesSent BIGINT) ROW FORMAT DELIMITED FIELDS TERMINATED > BY ','"); > > sql = "INSERT OVERWRITE " + mon_tblName + " SELECT ServerIP, > month(StartTime), SUM(BytesSent) from " + totallogs_tbl + " GROUP BY > ServerIP, month(StartTime)"; > > res = stmt.executeQuery(sql); > ============================================================> > *ERROR Message:* > > Exception in thread "main" java.sql.SQLException: Query returned non-zero > code: 11, cause: FAILED: Parse Error: line 1:17 cannot recognize input near > 'month_tbl' 'SELECT' 'ServerIP' in destination specification > > at > org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:189) > at jtv_jdbc_client.main(jtv_jdbc_client.java:72) > root@ip-10-12-97-109:/home/users/jtv/hive_jdbc# > ====================================================================> > I checked the field-names, made sure there are commas between the > attributes. spell-check etc. Can we have built-in aggregate funcitons (like > SUM) and date functions (like month(StartTime)).? To use them, should I do > anything special? I do not understand the error statement. > > Please advise. > > Thanks, > PD. > -- "...:::Aniket:::... Quetzalco@tl" |