You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Mich Talebzadeh <mi...@gmail.com> on 2016/09/08 23:18:21 UTC

Spark 2 does not recognize CURRENT_TIMESTAMP of Hive 2.0

The current time in Hive 2 is called CURREN_TIMESTAMP,

hive> SELECT FROM_unixtime(unix_timestamp(), 'yyyy/MM/dd HH:mm:ss.ss') ,
current_timestamp;
unix_timestamp(void) is deprecated. Use current_timestamp instead.
OK
2016/09/09 00:10:11.11  2016-09-09 00:10:11.808

The old FROM_unixtime(unix_timestamp(), 'yyyy/MM/dd HH:mm:ss.ss') is
depreciated.

So this works in Hive

INSERT INTO TABLE test.prices SELECT current_timestamp, 1,
"20160909-000551", "Waitrose", 98.15294

The first column in Hive ORC table ide defined as TIMESTAMP.

Try this from Spark

INSERT INTO TABLE test.prices SELECT current_timestamp, 1,
"20160909-000551", "Waitrose", 98.15294
16/09/09 00:07:20 ERROR JobScheduler: Error running job streaming job
1473376040000 ms.0
org.apache.spark.sql.AnalysisException: cannot resolve
'`current_timestamp`' given input columns: []; line 1 pos 37

It throws error with HiveContext("""INSERT INTO TABLE test.prices...""")









Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com


*Disclaimer:* Use it at your own risk. Any and all responsibility for any
loss, damage or destruction of data or any other property which may arise
from relying on this email's technical content is explicitly disclaimed.
The author will in no case be liable for any monetary damages arising from
such loss, damage or destruction.