hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mich Talebzadeh <mich.talebza...@gmail.com>
Subject Column type conversion in Hive
Date Sun, 20 Mar 2016 22:27:09 GMT
As a matter of interest how does how cast columns from say String to
Integer implicitly?

For example the following shows this

create table s(col1 String);
insert into s values("1");
insert into s values("2");

Now create a target table with col1 being integer


create table o (col1 Int);
insert into o select * from s;

select * from o;
+---------+--+
| o.col1  |
+---------+--+
| 1       |
| 2       |
+---------+--+

So this implicit column conversion from String to Integer happens without
intervention in the code. As a matter of interest what is the underlying
storage for Integer. In a conventional RDBMS this needs to be done through
cast (CHAR AS INT) etc?

Thanks



Dr Mich Talebzadeh



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



http://talebzadehmich.wordpress.com

Mime
View raw message