Hive - Column

> Database > Apache - Hive (HS|Hive Server)

1 - About

Relation - Column in Hive Context

Advertising

3 - Statistic

4 - Built-in

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+VirtualColumns

Hive 0.8.0 provides support for two virtual columns:

  • INPUT__FILE__NAME is the input file's name for a mapper task.
INPUT__FILE__NAME.sql
SELECT 
  INPUT__FILE__NAME, 
  KEY, 
  BLOCK__OFFSET__INSIDE__FILE 
FROM 
  src;
 
SELECT 
  KEY, 
  COUNT(INPUT__FILE__NAME) 
FROM 
  src 
GROUP BY KEY 
ORDER BY KEY;
  • BLOCK__OFFSET__INSIDE__FILE is the current global file position. For block compressed file, it is the current block's file offset, which is the current block's first byte's file offset.
BLOCK__OFFSET__INSIDE__FILE.sql
SELECT
  * 
FROM 
  src 
WHERE
  BLOCK__OFFSET__INSIDE__FILE > 12000
ORDER BY KEY;
db/hive/column.txt · Last modified: 2019/05/16 14:08 by gerardnico