土曜日, 11月 07, 2009

[HIVE] HQLの関数を確認

意外に説明が充実してる。

hive> DESCRIBE FUNCTION EXTENDED substr;
OK
substr(str, pos[, len]) - returns the substring of str that starts at pos and is
 of length len
pos is a 1-based index. If pos<0 the starting position is determined by counting
 backwards from the end of str.
Example:
   > SELECT substr('Facebook', 5) FROM src LIMIT 1;
  'book'
  > SELECT substr('Facebook', -5) FROM src LIMIT 1;
  'ebook'
  > SELECT substr('Facebook', 5, 1) FROM src LIMIT 1;
  'b'
Time taken: 0.156 seconds
hive>