Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> FROM INSERT after ADD COLUMN


+
yaboulna@... 2012-12-10, 00:35
+
Connell, Chuck 2012-12-10, 00:53
Copy link to this message
-
Re: FROM INSERT after ADD COLUMN
Hi Younos,

Since HiveQL doesn't support an insert..value statement, you can't insert
values into a specific column. Let's assume your table had the following
structure before the alter table..add columns statement was executed,

tab (a string, b bigint, c double)

Furthermore, let's assume that it had 100 rows. Now, let's assume you did
an alter table tab add columns (d binary). The new table structure will
look like below,

tab (a string, b bigint, c double, d binary)

You can't insert binary data into the 100 rows that were present prior to
the alter table statement by executing a HiveQL statement. HiveQL doesn't
support an insert..values statement like most RDBMSs. However, you can
delete the existing files and add new files that contain records
corresponding to the new table structure. Alternatively, you can skip the
deletion step and just add new files that correspond to the new table
structure. When you execute a HiveQL query, null will be returned for those
columns for which the data doesn't exist.

Hope this helps.

Thanks.
Shreepadma
On Sun, Dec 9, 2012 at 4:35 PM, <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I couldn't find any example of how to populate columns that were added to
> a table. How would Hive tell which row to append by each value of the newly
> added columns? Does it do a column name matching?
>
> Sincerely,
> Younos
>
>
>
>
+
yaboulna@... 2012-12-10, 01:02
+
Bertrand Dechoux 2012-12-10, 06:32
+
Shreepadma Venugopalan 2012-12-10, 18:32
+
Shreepadma Venugopalan 2012-12-10, 18:36
+
yaboulna@... 2012-12-10, 20:01
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB