I honestly don't know what is going on. Everything fails except basically SHOW DATABASES
.
Nothing on this page (below) even works. Everything gives me a NoViableAltException. This is both in Hive and Beeline CLI.
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions
My opinion is I shouldn't have to be connected to a DB to execute these commands which didn't initially work. But, I decided to try connecting to the default DB and still all the same failures. Created a new DB and same failures. Sources I've used for doc info...
http://www.folkstalk.com/2011/11/date-functions-in-hive.html
http://www.folkstalk.com/2011/11/difference-between-normal-tables-and.html
http://hortonworks.com/wp-content/uploads/2016/05/Hortonworks.CheatSheet.SQLtoHive.pdf
Add minutes to datetime in Hive
Nothing works. All NoViableAltException exception. I started the cloudera manger and all things check healthy except Impala. I'm using the CDH5 quickstart docker image. Tried both hive and beeline cli. Any help would be appreciated.
EDIT: Here is an example from another StackOverflow question that fails though different exception.
0: jdbc:hive2://localhost:10000/default> from_unixtime(unix_timestamp());
Error: Error while compiling statement: FAILED: ParseException line 1:0 cannot recognize input near 'from_unixtime' '(' 'unix_timestamp' (state=42000,code=40000)
0: jdbc:hive2://localhost:10000/default>
This one is a different exception but I can't get anything other than show databases/tables/etc to work.
Here is another...
hive> DATEDIFF('2000-03-01', '2000-01-10');
NoViableAltException(26@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1024)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:201)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:423)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:311)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1194)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1289)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1120)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1108)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:218)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:170)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:381)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:773)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:691)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:626)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:0 cannot recognize input near 'DATEDIFF' '(' ''2000-03-01''
Literally nothing I see on the net that should work works.
Just add SELECT.
SELECT from_unixtime(unix_timestamp());
SELECT DATEDIFF('2000-03-01', '2000-01-10');