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


Java VarCharHolder类代码示例

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


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

示例1: setup

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public void setup() {
	classifier = new WekaUpdatableClassifierHolder();
	function = new StringHolder();
	arffHeader = new StringHolder();
	firstRun = new BitHolder();
	instancesHolder = new ObjectHolder();
	instancesHolder.obj = null;
	//			instancesList = new LinkedListHolder<weka.core.Instances>();
	//			instancesList.list = new java.util.LinkedList<weka.core.Instances>();
	//			instancesList.algorithm=null;
	//			instancesList.options = null;
	classifier.classifier=null;
	function.value=null;
	arffHeader.value=null;
	firstRun.value=0;
	currVal = new VarCharHolder();
	updatable = new IntHolder();
	updatable.value=-1;
	aggregatable = new IntHolder();
	aggregatable.value=-1;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:22,代码来源:Weka.java

示例2: writeString

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
private void writeString(String readString, final MapOrListWriterImpl writer, String fieldName, boolean isList) {
  int length;
  byte[] strBytes;
  try {
    strBytes = readString.getBytes("UTF-8");
  } catch (UnsupportedEncodingException e) {
    throw new DrillRuntimeException("Unable to read string value for field: " + fieldName, e);
  }
  length = strBytes.length;
  ensure(length);
  workBuf.setBytes(0, strBytes);
  final VarCharHolder vh = new VarCharHolder();
  vh.buffer = workBuf;
  vh.start = 0;
  vh.end = length;
  if (isList == false) {
    writer.varChar(fieldName).write(vh);
  } else {
    writer.list.varChar().write(vh);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:22,代码来源:BsonRecordReader.java

示例3: getVarCharHolder

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public static VarCharHolder getVarCharHolder(DrillBuf buf, String s){
  VarCharHolder vch = new VarCharHolder();

  byte[] b = s.getBytes(Charsets.UTF_8);
  vch.start = 0;
  vch.end = b.length;
  vch.buffer = buf.reallocIfNeeded(b.length);
  vch.buffer.setBytes(0, b);
  return vch;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:ValueHolderHelper.java

示例4: prepareVarCharHolder

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public void prepareVarCharHolder(String value, VarCharHolder h) throws IOException {
  byte[] b = value.getBytes(Charsets.UTF_8);
  ensure(b.length);
  workBuf.setBytes(0, b);
  h.start = 0;
  h.end = b.length;
  h.buffer = workBuf;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:WorkingBuffer.java

示例5: testVectors

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
/**
 * Convenience method that allows running tests on various {@link ValueVector vector} instances.
 *
 * @param test test function to execute
 */
private void testVectors(VectorVerifier test) throws Exception {
  final MaterializedField[] fields = {
      MaterializedField.create(EMPTY_SCHEMA_PATH, UInt4Holder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, BitHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, VarCharHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, NullableVarCharHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedListVector.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, MapVector.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedMapVector.TYPE)
  };

  final ValueVector[] vectors = {
      new UInt4Vector(fields[0], allocator),
      new BitVector(fields[1], allocator),
      new VarCharVector(fields[2], allocator),
      new NullableVarCharVector(fields[3], allocator),
      new RepeatedListVector(fields[4], allocator, null),
      new MapVector(fields[5], allocator, null),
      new RepeatedMapVector(fields[6], allocator, null)
  };

  try {
    for (final ValueVector vector : vectors) {
      test.verify(vector);
    }
  } finally {
    AutoCloseables.close(vectors);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:35,代码来源:TestValueVector.java

示例6: setup

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public void setup() {
  currVal = new VarCharHolder();
  matcher = java.util.regex.Pattern.compile(
      org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(targetValue.start,  targetValue.end,  targetValue.buffer)).matcher("");
  charSequenceWrapper = new org.apache.drill.exec.expr.fn.impl.CharSequenceWrapper();
  matcher.reset(charSequenceWrapper);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:8,代码来源:SimpleRepeatedFunctions.java

示例7: testVectors

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
/**
 * Convenience method that allows running tests on various {@link ValueVector vector} instances.
 *
 * @param test test function to execute
 */
@SuppressWarnings("resource")
private void testVectors(VectorVerifier test) throws Exception {
  final MaterializedField[] fields = {
      MaterializedField.create(EMPTY_SCHEMA_PATH, UInt4Holder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, BitHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, VarCharHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, NullableVarCharHolder.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedListVector.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, MapVector.TYPE),
      MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedMapVector.TYPE)
  };

  final ValueVector[] vectors = {
      new UInt4Vector(fields[0], allocator),
      new BitVector(fields[1], allocator),
      new VarCharVector(fields[2], allocator),
      new NullableVarCharVector(fields[3], allocator),
      new RepeatedListVector(fields[4], allocator, null),
      new MapVector(fields[5], allocator, null),
      new RepeatedMapVector(fields[6], allocator, null)
  };

  try {
    for (final ValueVector vector : vectors) {
      test.verify(vector);
    }
  } finally {
    AutoCloseables.close(vectors);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:36,代码来源:TestValueVector.java

示例8: testCastVarChar

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
//cast to varchar(length)
public void testCastVarChar(@Injectable final DrillbitContext bitContext,
                          @Injectable UserClientConnection connection) throws Throwable {
  mockDrillbitContext(bitContext);

  final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarChar.json"), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
  final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));

  while(exec.next()) {
    final VarCharVector c0 = exec.getValueVectorById(new SchemaPath("int_lit_cast", ExpressionPosition.UNKNOWN), VarCharVector.class);
    final VarCharVector.Accessor a0 = c0.getAccessor();

    int count = 0;
    for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
        final VarCharHolder holder0 = new VarCharHolder();
        a0.get(i, holder0);
        assertEquals("123", StringFunctionHelpers.toStringFromUTF8(holder0.start, holder0.end, holder0.buffer));
        ++count;
    }
    assertEquals(5, count);
  }

  exec.close();

  context.close();

  if(context.getFailureCause() != null) {
    throw context.getFailureCause();
  }
  assertTrue(!context.isFailed());
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:36,代码来源:TestCastFunctions.java

示例9: mappify

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public static DrillBuf mappify(FieldReader reader, BaseWriter.ComplexWriter writer, DrillBuf buffer) {
  // Currently we expect single map as input
  if (DataMode.REPEATED == reader.getType().getMode() || !(reader.getType().getMinorType() == TypeProtos.MinorType.MAP)) {
    throw new DrillRuntimeException("kvgen function only supports Simple maps as input");
  }
  BaseWriter.ListWriter listWriter = writer.rootAsList();
  listWriter.start();
  BaseWriter.MapWriter mapWriter = listWriter.map();

  // Iterate over the fields in the map
  Iterator<String> fieldIterator = reader.iterator();
  while (fieldIterator.hasNext()) {
    String str = fieldIterator.next();
    FieldReader fieldReader = reader.reader(str);

    // Skip the field if its null
    if (fieldReader.isSet() == false) {
      mapWriter.end();
      continue;
    }

    // writing a new field, start a new map
    mapWriter.start();

    // write "key":"columnname" into the map
    VarCharHolder vh = new VarCharHolder();
    byte[] b = str.getBytes(Charsets.UTF_8);
    buffer = buffer.reallocIfNeeded(b.length);
    buffer.setBytes(0, b);
    vh.start = 0;
    vh.end = b.length;
    vh.buffer = buffer;
    mapWriter.varChar(fieldKey).write(vh);

    // Write the value to the map
    MapUtility.writeToMapFromReader(fieldReader, mapWriter);

    mapWriter.end();
  }
  listWriter.end();

  return buffer;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:44,代码来源:MappifyUtility.java

示例10: setup

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
public void setup() {
  currVal = new VarCharHolder();
  matcher = java.util.regex.Pattern.compile(
      org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(targetValue.start,  targetValue.end,  targetValue.buffer)).matcher("");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:SimpleRepeatedFunctions.java

示例11: testAfter

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testAfter() {
  final VarCharHolder left = hello;
  final VarCharHolder right = goodbye;
  assertTrue(ByteFunctionHelpers.compare(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == 1);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestByteComparisonFunctions.java

示例12: testBefore

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testBefore() {
  final VarCharHolder left = goodbye;
  final VarCharHolder right = hello;
  assertTrue(ByteFunctionHelpers.compare(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == -1);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestByteComparisonFunctions.java

示例13: testEqualCompare

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testEqualCompare() {
  final VarCharHolder left = hello;
  final VarCharHolder right = hello;
  assertTrue(ByteFunctionHelpers.compare(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == 0);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestByteComparisonFunctions.java

示例14: testEqual

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testEqual() {
  final VarCharHolder left = hello;
  final VarCharHolder right = hello;
  assertTrue(ByteFunctionHelpers.equal(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == 1);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestByteComparisonFunctions.java

示例15: testNotEqual

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testNotEqual() {
  final VarCharHolder left = hello;
  final VarCharHolder right = goodbye;
  assertTrue(ByteFunctionHelpers.equal(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == 0);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestByteComparisonFunctions.java


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