当前位置: 首页>>代码示例>>Java>>正文


Java ZeroVector类代码示例

本文整理汇总了Java中org.apache.drill.exec.vector.ZeroVector的典型用法代码示例。如果您正苦于以下问题:Java ZeroVector类的具体用法?Java ZeroVector怎么用?Java ZeroVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ZeroVector类属于org.apache.drill.exec.vector包,在下文中一共展示了ZeroVector类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.drill.exec.vector.ZeroVector; //导入依赖的package包/类
private void init(ValueVector v) {
  if (v instanceof UnionVector) {
    state = State.UNION;
    unionVector = (UnionVector) v;
    writer = new UnionWriter(unionVector);
  } else if (v instanceof ZeroVector) {
    state = State.UNTYPED;
  } else {
    setWriter(v);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:12,代码来源:PromotableWriter.java

示例2: transferTo

import org.apache.drill.exec.vector.ZeroVector; //导入依赖的package包/类
public void transferTo(ListVector target) {
  offsets.makeTransferPair(target.offsets).transfer();
  bits.makeTransferPair(target.bits).transfer();
  if (target.getDataVector() instanceof ZeroVector) {
    target.addOrGetVector(new VectorDescriptor(vector.getField().getType()));
  }
  getDataVector().makeTransferPair(target.getDataVector()).transfer();
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:9,代码来源:ListVector.java

示例3: handleList

import org.apache.drill.exec.vector.ZeroVector; //导入依赖的package包/类
/**
 * Sets and lists handled the same - as a repeated list of values
 */
@SuppressWarnings("unchecked")
private void handleList(int index, String name, Object value, StackState state) {

  // create the struct, if necessary
  ListVectorStruct struct = state.listVectors.get(name);
  if (struct == null) {
    MaterializedField field =
      MaterializedField.create(name, optional(MinorType.LIST));
    ListVector listVector = (ListVector) state.vectorFunc.apply(field, ListVector.class);
    listVector.allocateNew();
    struct = new ListVectorStruct(listVector);
    state.listVectors.put(name, struct);
  }

  // find the first item in the list
  List<Object> values;
  if (value instanceof List) {
    values = (List<Object>) value;
  } else {
    values = newArrayList((Collection<Object>) value);
  }

  // adjust the actual list contents to fill in 'null' values. Has to come after we figure out
  // the minor type so we can generate the right value vector
  values = adjustListValueForPointSelections(values, state);

  // there is only ever one vector that we use in a list, and its keyed by null
  String vectorName = "_0list_name";

  // move to the next state binding whatever gets created to this list
  ListVector list = struct.getVector();
  UInt4Vector offsets = list.getOffsetVector();
  int nextOffset = offsets.getAccessor().get(index);
  list.getMutator().setNotNull(index);
  int listIndex = 0;

  state = state.next(struct.getVectorFun());
  // ensure that we use the exact same vector each time and don't try to initialize it again
  ValueVector data = list.getDataVector();
  if (data != null && data != ZeroVector.INSTANCE) {
    if (data instanceof MapVector) {
      state.mapVectors.put(vectorName, new MapVectorStruct((MapVector) data));
    } else if (data instanceof ListVector) {
      state.listVectors.put(vectorName, new ListVectorStruct((ListVector) data));
    } else {
      state.scalars.put(vectorName, new ScalarVectorStruct(data));
    }
  }

  for (Object val : values) {
    // needed to fill the empty location. This would probably be cleaner to reason about by
    // matching up the sorted indexes and the values, but simpler to reason about this way.
    if (val != null) {
      // we should never need to create a sub-vector immediately - we created the vector above -
      // so send 'null' as the creator function.
      handleField(nextOffset + listIndex, vectorName, val, state);
    }
    listIndex++;
  }
  // mark down in the vector how far we got
  data = list.getDataVector();
  data.getMutator().setValueCount(data.getAccessor().getValueCount() + listIndex);
  // mark down how far into the vector we got this time
  offsets.getMutator().setSafe(index + 1, nextOffset + listIndex);
}
 
开发者ID:fineoio,项目名称:drill-dynamo-adapter,代码行数:69,代码来源:DynamoRecordReader.java


注:本文中的org.apache.drill.exec.vector.ZeroVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。