Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ArrayType.java
Go to the documentation of this file.
1 package com.cloudera.impala.catalog;
2 
3 import com.cloudera.impala.thrift.TColumnType;
4 import com.cloudera.impala.thrift.TTypeNode;
5 import com.cloudera.impala.thrift.TTypeNodeType;
6 import com.google.common.base.Preconditions;
7 
11 public class ArrayType extends Type {
12  private final Type itemType_;
13 
14  public ArrayType(Type itemType) {
15  itemType_ = itemType;
16  }
17 
18  public Type getItemType() { return itemType_; }
19 
20  @Override
21  public String toSql() {
22  return String.format("ARRAY<%s>", itemType_.toSql());
23  }
24 
25  @Override
26  public boolean equals(Object other) {
27  if (!(other instanceof ArrayType)) return false;
28  ArrayType otherArrayType = (ArrayType) other;
29  return otherArrayType.itemType_.equals(itemType_);
30  }
31 
32  @Override
33  public void toThrift(TColumnType container) {
34  TTypeNode node = new TTypeNode();
35  container.types.add(node);
36  Preconditions.checkNotNull(itemType_);
37  node.setType(TTypeNodeType.ARRAY);
38  itemType_.toThrift(container);
39  }
40 }
41 
void toThrift(TColumnType container)
Definition: ArrayType.java:33