Hi,

I tried the following and it worked fine.

create table foo (x int);
insert into foo values (5);
select * from foo;

But when I try the following, I get NULL

create table bar(x timestamp);
insert into bar values (500);
select * from bar;

Regards,
Anand

On Tue, Oct 27, 2015 at 9:15 PM, Alan Gates <alanfga...@gmail.com> wrote:

> Actually, for INSERT VALUES you don't have to have a transactional table
> (you do to use UPDATE or DELETE).  So I would expect this to work as is.
> What happens if you do:
>
> create table foo (x int);
> insert into foo values (5);
> select * from foo;
>
> Do you get 5 or null?  This will tell whether the issue is in reading the
> table or in the timestamp casting.
>
> Alan.
>
> Lefty Leverenz <leftylever...@gmail.com>
> October 26, 2015 at 20:30
> Your table has to support transactions (see Inserting values into tables
> from SQL
> <https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingvaluesintotablesfromSQL>),
> so create it with the TBLPROPERTIES clause
> <https://cwiki.apache.org/confluence/display/Hive/Hive+Transactions#HiveTransactions-TableProperties>
> :
>
> CREATE TABLE tmp (reporttime timestamp) TBLPROPERTIES
> ("transactional"="true");
>
> Unfortunately the examples in Inserting values into tables from SQL
> <https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingvaluesintotablesfromSQL>
>  don't
> show the TBLPROPERTIES clause -- that needs to be fixed in the wiki.
>
> -- Lefty
>
>
>
> AnandaVelMurugan Chandra Mohan <ananthu2...@gmail.com>
> October 26, 2015 at 17:49
> Hi,
>
> I believe my Hive version is Apache 1.2.0. I guessed it from the folder
> and hive-hwi.jar names.
>
> I am trying to insert values into a column of type timestamp. It does not
> work
>
> This is how I create the table
> CREATE TABLE tmp (reporttime timestamp);
>
> I tried following insert queries
> INSERT INTO TABLE tmp VALUES(734196.3552);
>
> INSERT INTO TABLE tmp VALUES(734196);
>
> I read that values of timestamp could be integers which are interpreted as
> seconds since unix epoch time or float which are interpreted as seconds
> since unix epoch time with nanasecond precision or string of format
> 'YYYY-mm-dd'. I cannot use third string option as of now. So I am trying
> other two options i.e. int and float.
>
> When I do a select query, I get null
>
> I tried
>
> select to_date(reporttime) from tmp
> select reporttime from tmp
>
> Please help if you have any idea.
> --
> Regards,
> Anand
>
>


-- 
Regards,
Anand

Reply via email to