· 6 years ago · Jun 29, 2019, 04:52 PM
1col1=id
2col2=visitDate
3col3=comment
4col4=age
5
6ROW FORMAT DELIMITED
7FIELDS TERMINATED BY ','
8STORED AS TEXTFILE
9;```
10
11MAIN Table:
12
13create external table IF NOT EXISTS dummy1(id string,comment string)
14PARTITIONED BY (visitDate string, age string)
15ROW FORMAT DELIMITED
16FIELDS TERMINATED BY ','
17STORED AS ORC
18;
19
20
21Result:
22
23Temporary table:
24
25select *from incr_dummy1;
26
271 11 a 20
282 12 b 3
291 13 c 34
304 14 d 23
315 15 e 45
326 16 f 65
337 17 g 78
348 18 h 9
359 19 i 12
3610 20 j 34
37
38select visitDate,age from incr_dummy1;
39
4011 20
4112 3
4213 34
4314 23
4415 45
4516 65
4617 78
4718 9
4819 12
4920 34
50
51
52Main Table:
53
54select *from dummy1;
55
561 11 a 20
572 12 b 3
581 13 c 34
594 14 d 23
605 15 e 45
616 16 f 65
627 17 g 78
638 18 h 9
649 19 i 12
6510 20 j 34
66
67select visitDate,age from dummy1;
68
69a 20
70b 3
71c 34
72d 23
73e 45
74f 65
75g 78
76h 9
77i 12
78j 34
79
80
81so in above main external table,the value of "comment" column is coming when I'm querying for "visitDate" column.
82
83
84Please let me know what mistake I'm doing here?