15 package com.cloudera.impala.catalog;
17 import java.util.List;
19 import com.cloudera.impala.thrift.TPrimitiveType;
20 import com.google.common.collect.Lists;
26 NULL_TYPE(
"NULL_TYPE", 1, TPrimitiveType.NULL_TYPE),
27 BOOLEAN(
"BOOLEAN", 1, TPrimitiveType.BOOLEAN),
28 TINYINT(
"TINYINT", 1, TPrimitiveType.TINYINT),
29 SMALLINT(
"SMALLINT", 2, TPrimitiveType.SMALLINT),
30 INT(
"INT", 4, TPrimitiveType.INT),
31 BIGINT(
"BIGINT", 8, TPrimitiveType.BIGINT),
32 FLOAT(
"FLOAT", 4, TPrimitiveType.FLOAT),
33 DOUBLE(
"DOUBLE", 8, TPrimitiveType.DOUBLE),
34 DATE(
"DATE", 4, TPrimitiveType.DATE),
35 DATETIME(
"DATETIME", 8, TPrimitiveType.DATETIME),
37 TIMESTAMP(
"TIMESTAMP", 16, TPrimitiveType.TIMESTAMP),
40 STRING(
"STRING", 16, TPrimitiveType.STRING),
41 VARCHAR(
"VARCHAR", 16, TPrimitiveType.VARCHAR),
44 BINARY(
"BINARY", -1, TPrimitiveType.BINARY),
47 DECIMAL(
"DECIMAL", 16, TPrimitiveType.DECIMAL),
50 CHAR(
"CHAR", -1, TPrimitiveType.CHAR);
56 private PrimitiveType(String description,
int slotSize, TPrimitiveType thriftType) {
57 description_ = description;
59 thriftType_ = thriftType;
70 case NULL_TYPE:
return NULL_TYPE;
71 case BOOLEAN:
return BOOLEAN;
72 case TINYINT:
return TINYINT;
73 case SMALLINT:
return SMALLINT;
75 case BIGINT:
return BIGINT;
76 case FLOAT:
return FLOAT;
77 case DOUBLE:
return DOUBLE;
78 case STRING:
return STRING;
79 case VARCHAR:
return VARCHAR;
80 case TIMESTAMP:
return TIMESTAMP;
81 case CHAR:
return CHAR;
82 case DECIMAL:
return DECIMAL;
83 case BINARY:
return BINARY;
88 public TPrimitiveType
toThrift() {
return thriftType_; }
91 List<TPrimitiveType> result = Lists.newArrayList();
93 result.add(t.toThrift());
static int getMaxSlotSize()
final String description_
static PrimitiveType fromThrift(TPrimitiveType t)
TPrimitiveType toThrift()
final TPrimitiveType thriftType_
PrimitiveType(String description, int slotSize, TPrimitiveType thriftType)
static List< TPrimitiveType > toThrift(PrimitiveType[] types)