samedi 9 août 2014

Hadoop - affichage date qu'une seule fois [façon élégante] dans la ruche - Stack Overflow


How do I display the date only once using the inbuilt Date and Time functions


In mysql we can do select curdate(); to get


+------------+
| curdate() |
+------------+
| 2013-07-23 |
+------------+

Trying select unixtime(); in Hive gives me FAILED: ParseException line 1:17 mismatched input '<EOF>' expecting FROM near ')' in from clause


Doing , select from_unixtime(unix_timestamp(),"yyyy-MM-hh") from abc.xyz LIMIT 1; gives me


OK
2013-07-03

my expected output but it doesn't seem really sensible to me to use a random database and its table just for accessing the date. What is the proper way of doing this?




Currently, Hive does not support constructing rows without reading any other tables (which is what you are trying to do when you run select curdate() or select curdate() from dual).


This is work in progress.




use unix_timestamp()
For other date functions look here



How do I display the date only once using the inbuilt Date and Time functions


In mysql we can do select curdate(); to get


+------------+
| curdate() |
+------------+
| 2013-07-23 |
+------------+

Trying select unixtime(); in Hive gives me FAILED: ParseException line 1:17 mismatched input '<EOF>' expecting FROM near ')' in from clause


Doing , select from_unixtime(unix_timestamp(),"yyyy-MM-hh") from abc.xyz LIMIT 1; gives me


OK
2013-07-03

my expected output but it doesn't seem really sensible to me to use a random database and its table just for accessing the date. What is the proper way of doing this?



Currently, Hive does not support constructing rows without reading any other tables (which is what you are trying to do when you run select curdate() or select curdate() from dual).


This is work in progress.



use unix_timestamp()
For other date functions look here


0 commentaires:

Enregistrer un commentaire