mirror of
https://github.com/apache/impala.git
synced 2026-01-05 12:01:11 -05:00
Adding EXTRACT builtin.
Change-Id: I6de20f336ecdfa3acd8d3a9166cff4a062baaacc Reviewed-on: http://gerrit.ent.cloudera.com:8080/2247 Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com> Tested-by: jenkins (cherry picked from commit f233955020ffbd1023f2d6adbbfb22e267986305) Reviewed-on: http://gerrit.ent.cloudera.com:8080/2370
This commit is contained in:
@@ -1,5 +1,37 @@
|
||||
====
|
||||
---- QUERY
|
||||
# test extract with non-constant field name
|
||||
select b.unit, extract(a.ts, b.unit) from
|
||||
(values(cast('2013-02-18 16:46:00.01' as timestamp) ts)) a
|
||||
cross join
|
||||
(values('year' unit), ('month'), ('day'), ('hour'), ('minute'), ('second'),
|
||||
('millisecond'), ('epoch' )) b
|
||||
---- TYPES
|
||||
string, int
|
||||
---- RESULTS
|
||||
'year',2013
|
||||
'month',2
|
||||
'day',18
|
||||
'hour',16
|
||||
'minute',46
|
||||
'second',0
|
||||
'millisecond',10
|
||||
'epoch',1361205960
|
||||
====
|
||||
---- QUERY
|
||||
# EXTRACT fields from timestamp
|
||||
select EXTRACT(timestamp_col, 'yEar'), EXTRACT(timestamp_col, 'MilliSECond')
|
||||
from alltypesagg order by id limit 5
|
||||
---- TYPES
|
||||
int, int
|
||||
---- RESULTS
|
||||
2010,0
|
||||
2010,0
|
||||
2010,100
|
||||
2010,300
|
||||
2010,600
|
||||
====
|
||||
---- QUERY
|
||||
# IS NULL predicate
|
||||
select count(*) from alltypesagg
|
||||
---- TYPES
|
||||
|
||||
Reference in New Issue
Block a user