stirng如果想直接和数据比,比较的右边值不带引号就能按数据比较了,hive会强转string为int进行比较
例如:'3'>2
cat /tmp/test/name.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
create table test123(name string)
LOAD DATA LOCAL INPATH '/tmp/test/name.txt' OVERWRITE INTO TABLE tmp1.test123
1
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
select * from test123 order by name;
1
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
select * from test123 where name >9;
10
11
12
13
14
15
16
17
hive> select * from test123 where name >'9';
no result
hive> select * from test123 where name >'10';
2
3
4
5
6
7
8
9
11
12
13
14
15
16
17