Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - issure about add new columns in table ,but use hive-jdbc can not get these clumns value


Copy link to this message
-
Re: issure about add new columns in table ,but use hive-jdbc can not get these clumns value
ch huang 2013-11-28, 02:34
seems hive jdbc cache the metadata from remote metadata database,but when i
test on partition table ,it's not a metadata sync problem ,the all new
column value is NULL
hive (default)> create external table test_alex1_part (id string,myname
string) partitioned by(dt string);
OK
Time taken: 0.263 seconds
hive (default)> alter table test_alex1_part add partition (dt='2013-11-28')
location '2013-11-28';

0: jdbc:hive2://localhost:10000>  insert overwrite table test_alex1_part
partition(dt='2013-11-28') select id,myname from test_alex1;
+-----+---------+
| id  | myname  |
+-----+---------+
+-----+---------+
No rows selected (11.91 seconds)
0: jdbc:hive2://localhost:10000> select * from test_alex1_part;
+-------------------------------------------------------------------+---------+-------------+
|                                id                                 |
myname  |     dt      |
+-------------------------------------------------------------------+---------+-------------+
| 20501B55B0C64273A5316C5078442569E425CC318ADC454CA163D72503489436  |
1       | 2013-11-28  |
| 20501B55B0C64273A5316C5078442569E3D87D24CA4E42D9A200E391417A7994  |
1       | 2013-11-28  |
| 20501B55B0C64273A5316C5078442569814086424B2942919C97DF1D2D2C1F55  |
1       | 2013-11-28  |
| 205018A818FB43A38CC29FF701E47D8B205018A818FB43A38CC29FF701E47D8B  |
1       | 2013-11-28  |
| 205016D04EDA435CB578D059F931221EB9F06E42815243A486B611B96366DD01  |
1       | 2013-11-28  |
| 205016D04EDA435CB578D059F931221E205016D04EDA435CB578D059F931221E  |
1       | 2013-11-28  |
| 20500D24895641DBBBDBE71640E57887EA06A0AEB4324117B8125FC815297B36  |
1       | 2013-11-28  |
| 205006E8A3EB4CA1997D947D89C5FD1B205006E8A3EB4CA1997D947D89C5FD1B  |
1       | 2013-11-28  |
| 2050054E19B44C4D992D97C1661A26C32050054E19B44C4D992D97C1661A26C3  |
1       | 2013-11-28  |
| 204fa32a43ef4aefac3b391562c5a25b7149D57B47E74C6F8C22CC30292FADF1  |
1       | 2013-11-28  |
+-------------------------------------------------------------------+---------+-------------+
0: jdbc:hive2://localhost:10000> alter table test_alex1_part add
columns(number string);
No rows affected (0.187 seconds)
0: jdbc:hive2://localhost:10000> select * from test_alex1_part;
+-------------------------------------------------------------------+---------+---------+-------------+
|                                id                                 |
myname  | number  |     dt      |
+-------------------------------------------------------------------+---------+---------+-------------+
| 20501B55B0C64273A5316C5078442569E425CC318ADC454CA163D72503489436  |
1       |         | 2013-11-28  |
| 20501B55B0C64273A5316C5078442569E3D87D24CA4E42D9A200E391417A7994  |
1       |         | 2013-11-28  |
| 20501B55B0C64273A5316C5078442569814086424B2942919C97DF1D2D2C1F55  |
1       |         | 2013-11-28  |
| 205018A818FB43A38CC29FF701E47D8B205018A818FB43A38CC29FF701E47D8B  |
1       |         | 2013-11-28  |
| 205016D04EDA435CB578D059F931221EB9F06E42815243A486B611B96366DD01  |
1       |         | 2013-11-28  |
| 205016D04EDA435CB578D059F931221E205016D04EDA435CB578D059F931221E  |
1       |         | 2013-11-28  |
| 20500D24895641DBBBDBE71640E57887EA06A0AEB4324117B8125FC815297B36  |
1       |         | 2013-11-28  |
| 205006E8A3EB4CA1997D947D89C5FD1B205006E8A3EB4CA1997D947D89C5FD1B  |
1       |         | 2013-11-28  |
| 2050054E19B44C4D992D97C1661A26C32050054E19B44C4D992D97C1661A26C3  |
1       |         | 2013-11-28  |
| 204fa32a43ef4aefac3b391562c5a25b7149D57B47E74C6F8C22CC30292FADF1  |
1       |         | 2013-11-28  |
+-------------------------------------------------------------------+---------+---------+-------------+
10 rows selected (0.385 seconds)

hive (default)> select * from test_alex1_part where dt='2013-11-28';
OK
20501B55B0C64273A5316C5078442569E425CC318ADC454CA163D72503489436
1       NULL    2013-11-28
20501B55B0C64273A5316C5078442569E3D87D24CA4E42D9A200E391417A7994
1       NULL    2013-11-28
20501B55B0C64273A5316C5078442569814086424B2942919C97DF1D2D2C1F55
1       NULL    2013-11-28
205018A818FB43A38CC29FF701E47D8B205018A818FB43A38CC29FF701E47D8B
1       NULL    2013-11-28
205016D04EDA435CB578D059F931221EB9F06E42815243A486B611B96366DD01
1       NULL    2013-11-28
205016D04EDA435CB578D059F931221E205016D04EDA435CB578D059F931221E
1       NULL    2013-11-28
20500D24895641DBBBDBE71640E57887EA06A0AEB4324117B8125FC815297B36
1       NULL    2013-11-28
205006E8A3EB4CA1997D947D89C5FD1B205006E8A3EB4CA1997D947D89C5FD1B
1       NULL    2013-11-28
2050054E19B44C4D992D97C1661A26C32050054E19B44C4D992D97C1661A26C3
1       NULL    2013-11-28
204fa32a43ef4aefac3b391562c5a25b7149D57B47E74C6F8C22CC30292FADF1
1       NULL    2013-11-28

On Thu, Nov 28, 2013 at 10:08 AM, ch huang <[EMAIL PROTECTED]> wrote: