-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.hql
109 lines (83 loc) · 3.04 KB
/
test.hql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
add jar target/simple-writable-serder-0.0.1-SNAPSHOT.jar
;
-------------------------
-- primative_test
-------------------------
drop table if exists primative_test
;
create table primative_test (a_varint tinyint, a_short smallint, a_int int, a_long bigint, a_float float, a_double double, a_bool boolean, a_text string)
ROW FORMAT SERDE 'com.nputmedia.hadoop.hive.simplwritableserde.SimpleWritableSerde'
stored as
INPUTFORMAT 'com.nputmedia.hadoop.hive.simplwritableserde.RawBytesSequenceFileInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
-- location '/user/ntroutm/primative_test'
;
load data local inpath 'src/test/resources/primative_test.seq' into table primative_test
;
select * from primative_test
;
-------------------------
-- list_int_test
-------------------------
drop table if exists list_int_test
;
create table list_int_test (int_list array<int>)
ROW FORMAT SERDE 'com.nputmedia.hadoop.hive.simplwritableserde.SimpleWritableSerde'
stored as
INPUTFORMAT 'com.nputmedia.hadoop.hive.simplwritableserde.RawBytesSequenceFileInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
;
load data local inpath 'src/test/resources/list_int_test.seq' into table list_int_test
;
select * from list_int_test
;
-------------------------
-- simple_map_test
-------------------------
drop table if exists simple_map_test
;
create table simple_map_test (simple_map map<string, int>)
ROW FORMAT SERDE 'com.nputmedia.hadoop.hive.simplwritableserde.SimpleWritableSerde'
stored as
INPUTFORMAT 'com.nputmedia.hadoop.hive.simplwritableserde.RawBytesSequenceFileInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
;
load data local inpath 'src/test/resources/simple_map_test.seq' into table simple_map_test
;
select * from simple_map_test
;
-------------------------
-- simple_struct_test
-------------------------
drop table if exists simple_struct_test
;
create table simple_struct_test (simple_struct struct<x:tinyint, txt:string>)
ROW FORMAT SERDE 'com.nputmedia.hadoop.hive.simplwritableserde.SimpleWritableSerde'
stored as
INPUTFORMAT 'com.nputmedia.hadoop.hive.simplwritableserde.RawBytesSequenceFileInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
;
load data local inpath 'src/test/resources/simple_struct_test.seq' into table simple_struct_test
;
select * from simple_struct_test
;
-------------------------
-- full_test
-------------------------
drop table if exists full_test
;
create table full_test (
rand_str string,
pointless_int int,
points array<struct<x:int, y:int>>,
complicated struct<txt:string, half:double, mapit:map<tinyint, struct<foo:string, square:int>>>
)
ROW FORMAT SERDE 'com.nputmedia.hadoop.hive.simplwritableserde.SimpleWritableSerde'
stored as
INPUTFORMAT 'com.nputmedia.hadoop.hive.simplwritableserde.RawBytesSequenceFileInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
;
load data local inpath 'src/test/resources/full_test.seq' into table full_test
;
select * from full_test
;