hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ch huang <justlo...@gmail.com>
Subject Re: issure about add new columns in table ,but use hive-jdbc can not get these clumns value
Date Thu, 28 Nov 2013 02:34:04 GMT
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 <justlooks@gmail.com> wrote:

> hi,maillist:
>               i add some new columns to hive table ,but find when i use
> beeline, or write my own java code,i can not get these new columns
> value,but when i use hive shell,it's ok
>
>
> 0: jdbc:hive2://localhost:10000> desc  test_alex1;
> +-----------+------------+----------+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+
> | id        | string     |          |
> | myname    | string     |          |
> +-----------+------------+----------+
> 2 rows selected (0.187 seconds)
> 0: jdbc:hive2://localhost:10000> alter table test_alex1 add columns (bee
> string);
> No rows affected (0.239 seconds)
> 0: jdbc:hive2://localhost:10000> desc
> test_alex1;
> +-----------+------------+----------+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+
> | id        | string     |          |
> | myname    | string     |          |
> | bee       | string     |          |
> +-----------+------------+----------+
> 3 rows selected (0.183 seconds)
>
>
> 0: jdbc:hive2://localhost:10000> select id,myname,bee from test_alex1;
>
> +-------------------------------------------------------------------+----------+
> |                                id                                 |
> myname   |
>
> +-------------------------------------------------------------------+----------+
> | 20501B55B0C64273A5316C5078442569E425CC318ADC454CA163D72503489436  |
> 1        |
> | 20501B55B0C64273A5316C5078442569E3D87D24CA4E42D9A200E391417A7994  |
> 1        |
> | 20501B55B0C64273A5316C5078442569814086424B2942919C97DF1D2D2C1F55  |
> 1        |
> | 205018A818FB43A38CC29FF701E47D8B205018A818FB43A38CC29FF701E47D8B  |
> 1        |
> | 205016D04EDA435CB578D059F931221EB9F06E42815243A486B611B96366DD01  |
> 1        |
> | 205016D04EDA435CB578D059F931221E205016D04EDA435CB578D059F931221E  |
> 1        |
> | 20500D24895641DBBBDBE71640E57887EA06A0AEB4324117B8125FC815297B36  |
> 1        |
> | 205006E8A3EB4CA1997D947D89C5FD1B205006E8A3EB4CA1997D947D89C5FD1B  |
> 1        |
> | 2050054E19B44C4D992D97C1661A26C32050054E19B44C4D992D97C1661A26C3  |
> 1        |
> | 204fa32a43ef4aefac3b391562c5a25b7149D57B47E74C6F8C22CC30292FADF1  |
> 1        |
>
> +-------------------------------------------------------------------+----------+
> 10 rows selected (11.679 seconds)
>
>
> hive (default)> select * from test_alex1;
> OK
> 20501B55B0C64273A5316C5078442569E425CC318ADC454CA163D72503489436
> 1       1
> 20501B55B0C64273A5316C5078442569E3D87D24CA4E42D9A200E391417A7994
> 1       2
> 20501B55B0C64273A5316C5078442569814086424B2942919C97DF1D2D2C1F55
> 1       3
> 205018A818FB43A38CC29FF701E47D8B205018A818FB43A38CC29FF701E47D8B
> 1       4
> 205016D04EDA435CB578D059F931221EB9F06E42815243A486B611B96366DD01
> 1       5
> 205016D04EDA435CB578D059F931221E205016D04EDA435CB578D059F931221E
> 1       6
> 20500D24895641DBBBDBE71640E57887EA06A0AEB4324117B8125FC815297B36
> 1       7
> 205006E8A3EB4CA1997D947D89C5FD1B205006E8A3EB4CA1997D947D89C5FD1B
> 1       8
> 2050054E19B44C4D992D97C1661A26C32050054E19B44C4D992D97C1661A26C3
> 1       9
> 204fa32a43ef4aefac3b391562c5a25b7149D57B47E74C6F8C22CC30292FADF1
> 1       10
>
>

Mime
View raw message