栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Hive ExprNodeDesc 及子类分析

Hive ExprNodeDesc 及子类分析

ExprNodeDesc

ExprNodeDesc可以保持一个 Node 的类型。

 public ExprNodeDesc(TypeInfo typeInfo) {
    this.typeInfo = typeInfo;
    if (typeInfo == null) {
      throw new RuntimeException("typeInfo cannot be null!");
    }
  }

子类有:

ExprNodeNullDesc 用于表示 null Node。 ExprNodeConstantDesc 表示一个常量,存储常量的 TypeInfo 和 Value。 ExprNodeFieldDesc 表示字段
public class ExprNodeFieldDesc extends exprNodeDesc implements Serializable {

  exprNodeDesc desc;
  String fieldName;
  
  // Used to support a.b where a is a list of struct that contains a field called b.
  // a.b will return an array that contains field b of all elements of array a. 
  Boolean isList;
}

字段主要用法

ExprNodeFieldDesc fieldDesc = ...;
leftevaluator = ExprNodeevaluatorFactory.get(fieldDesc.getDesc());
leftevaluator.evaluate(row, rowInspector, leftInspectableObject);
ExprNodeFuncDesc

用于表示函数。children 用于描述参数个数和类型。

public class exprNodeFuncDesc extends exprNodeDesc implements Serializable {

  private static final long serialVersionUID = 1L;
  private Class UDFClass;
  private Method UDFMethod;
  private ArrayList children; 
  
  public exprNodeFuncDesc() {}
  public exprNodeFuncDesc(TypeInfo typeInfo, Class UDFClass, 
                          Method UDFMethod, ArrayList children) {
    super(typeInfo);
    assert(UDFClass != null);
    this.UDFClass = UDFClass;
    assert(UDFMethod != null);
    this.UDFMethod = UDFMethod;
    this.children = children;
  }
  ...
 }
用于描述 index node
public class exprNodeIndexDesc extends exprNodeDesc implements Serializable {
  private static final long serialVersionUID = 1L;
  exprNodeDesc desc;
  exprNodeDesc index;
  
  public exprNodeIndexDesc() {}
  public exprNodeIndexDesc(TypeInfo typeInfo, exprNodeDesc desc, exprNodeDesc index) {
    super(typeInfo);
    this.desc = desc;
    this.index = index;    
  }
}
exprNodeColumnDesc 用于描述 column,和 field 不同的是,作为输出的 column 的描述。
public class exprNodeColumnDesc extends exprNodeDesc implements Serializable {
  private static final long serialVersionUID = 1L;
  private String column;
  
  public exprNodeColumnDesc() {}
  public exprNodeColumnDesc(TypeInfo typeInfo, String column) {
    super(typeInfo);
    this.column = column;
  }
  }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/674304.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号