• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VarCharHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testAfterLong

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


示例17: testBeforeLong

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


示例18: testEqualCompareLong

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


示例19: testEqualLong

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


示例20: testNotEqualLong

import org.apache.drill.exec.expr.holders.VarCharHolder; //导入依赖的package包/类
@Test
public void testNotEqualLong() {
  final VarCharHolder left = helloLong;
  final VarCharHolder right = goodbyeLong;
  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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HystrixThreadPoolMetrics类代码示例发布时间:2022-05-22
下一篇:
Java DelegateAction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap