gpt4 book ai didi

org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantIntObjectInspector类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 12:45:05 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantIntObjectInspector类的一些代码示例,展示了WritableConstantIntObjectInspector类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableConstantIntObjectInspector类的具体详情如下:
包路径:org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantIntObjectInspector
类名称:WritableConstantIntObjectInspector

WritableConstantIntObjectInspector介绍

[英]A WritableConstantIntObjectInspector is a WritableIntObjectInspector that implements ConstantObjectInspector.
[中]WritableConstantObjectInspector是实现ConstantObjectInspector的WritableInObjectInspector。

代码示例

代码示例来源:origin: apache/hive

IntWritable value = ((WritableConstantIntObjectInspector) arg).getWritableConstantValue();

代码示例来源:origin: apache/hive

return new WritableConstantShortObjectInspector((ShortWritable)value);
case INT:
 return new WritableConstantIntObjectInspector((IntWritable)value);
case LONG:
 return new WritableConstantLongObjectInspector((LongWritable)value);

代码示例来源:origin: org.spark-project.hive/hive-serde

return new WritableConstantShortObjectInspector((ShortWritable)value);
case INT:
 return new WritableConstantIntObjectInspector((IntWritable)value);
case LONG:
 return new WritableConstantLongObjectInspector((LongWritable)value);

代码示例来源:origin: apache/hive

IntWritable value = ((WritableConstantIntObjectInspector)arg).getWritableConstantValue();

代码示例来源:origin: com.github.hyukjinkwon/hive-serde

return new WritableConstantShortObjectInspector((ShortWritable)value);
case INT:
 return new WritableConstantIntObjectInspector((IntWritable)value);
case LONG:
 return new WritableConstantLongObjectInspector((LongWritable)value);

代码示例来源:origin: apache/hive

@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
 if (arguments.length == 1) {
  sourceOI = arguments[0];
  return objectInspectorConverter.convert(sourceOI);
 }
 if (arguments.length == 2 && (arguments[0] instanceof UnionObjectInspector)
   && (arguments[1] instanceof WritableConstantIntObjectInspector)) {
  tag = ((WritableConstantIntObjectInspector) arguments[1]).getWritableConstantValue().get();
  unionOI = (UnionObjectInspector) arguments[0];
  List<ObjectInspector> fieldOIs = ((UnionObjectInspector) arguments[0]).getObjectInspectors();
  if (tag < 0 || tag >= fieldOIs.size()) {
   throw new UDFArgumentException(
     "int constant must be a valid union tag for " + unionOI.getTypeName() + ". Expected 0-"
       + (fieldOIs.size() - 1) + " got: " + tag);
  }
  return fieldOIs.get(tag);
 }
 String argumentTypes = "nothing";
 if (arguments.length > 0) {
  List<String> typeNames = new ArrayList<>();
  for (ObjectInspector oi : arguments) {
   typeNames.add(oi.getTypeName());
  }
  argumentTypes = typeNames.toString();
 }
 throw new UDFArgumentException(
   "Unsupported arguments. Expected a type containing a union or a union and an int constant, got: "
     + argumentTypes);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

return new WritableConstantShortObjectInspector((ShortWritable)value);
case INT:
 return new WritableConstantIntObjectInspector((IntWritable)value);
case LONG:
 return new WritableConstantLongObjectInspector((LongWritable)value);

代码示例来源:origin: apache/drill

IntWritable value = ((WritableConstantIntObjectInspector)arg).getWritableConstantValue();

代码示例来源:origin: org.apache.hive/hive-serde

return new WritableConstantShortObjectInspector((ShortWritable)value);
case INT:
 return new WritableConstantIntObjectInspector((IntWritable)value);
case LONG:
 return new WritableConstantLongObjectInspector((LongWritable)value);

代码示例来源:origin: apache/drill

IntWritable value = ((WritableConstantIntObjectInspector) arg).getWritableConstantValue();

代码示例来源:origin: apache/hive

@Test(expected = UDFArgumentException.class)
public void initialize_NegativeTagThrowsException() throws UDFArgumentException {
 when(tagOI.getWritableConstantValue()).thenReturn(new IntWritable(-1));
 underTest.initialize(new ObjectInspector[] { unionOI, tagOI });
}

代码示例来源:origin: apache/drill

@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
 if (arguments.length == 1) {
  sourceOI = arguments[0];
  return objectInspectorConverter.convert(sourceOI);
 }
 if (arguments.length == 2 && (arguments[0] instanceof UnionObjectInspector)
   && (arguments[1] instanceof WritableConstantIntObjectInspector)) {
  tag = ((WritableConstantIntObjectInspector) arguments[1]).getWritableConstantValue().get();
  unionOI = (UnionObjectInspector) arguments[0];
  List<ObjectInspector> fieldOIs = ((UnionObjectInspector) arguments[0]).getObjectInspectors();
  if (tag < 0 || tag >= fieldOIs.size()) {
   throw new UDFArgumentException(
     "int constant must be a valid union tag for " + unionOI.getTypeName() + ". Expected 0-"
       + (fieldOIs.size() - 1) + " got: " + tag);
  }
  return fieldOIs.get(tag);
 }
 String argumentTypes = "nothing";
 if (arguments.length > 0) {
  List<String> typeNames = new ArrayList<>();
  for (ObjectInspector oi : arguments) {
   typeNames.add(oi.getTypeName());
  }
  argumentTypes = typeNames.toString();
 }
 throw new UDFArgumentException(
   "Unsupported arguments. Expected a type containing a union or a union and an int constant, got: "
     + argumentTypes);
}

代码示例来源:origin: apache/hive

@Test(expected = UDFArgumentException.class)
public void initialize_OutOfBoundsTagThrowsException() throws UDFArgumentException {
 when(unionOI.getObjectInspectors()).thenReturn(
   ImmutableList.<ObjectInspector> of(
     PrimitiveObjectInspectorFactory.writableStringObjectInspector,
     PrimitiveObjectInspectorFactory.writableLongObjectInspector));
 when(tagOI.getWritableConstantValue()).thenReturn(new IntWritable(2));
 underTest.initialize(new ObjectInspector[] { unionOI, tagOI });
}

代码示例来源:origin: apache/hive

@Test
public void initialize_UnionAndTagArguments() throws UDFArgumentException {
 when(unionOI.getObjectInspectors()).thenReturn(
   ImmutableList.<ObjectInspector> of(
     PrimitiveObjectInspectorFactory.writableStringObjectInspector,
     PrimitiveObjectInspectorFactory.writableLongObjectInspector));
 when(tagOI.getWritableConstantValue()).thenReturn(new IntWritable(0));
 ObjectInspector result = underTest.initialize(new ObjectInspector[] { unionOI, tagOI });
 assertThat(result, is((ObjectInspector) PrimitiveObjectInspectorFactory.writableStringObjectInspector));
}

代码示例来源:origin: apache/hive

writeIdBits = ((WritableConstantIntObjectInspector)arguments[0]).getWritableConstantValue().get();
taskIdBits = ((WritableConstantIntObjectInspector)arguments[1]).getWritableConstantValue().get();
rowIdBits = 64 - (writeIdBits + taskIdBits);

代码示例来源:origin: apache/hive

@Test
public void evaluate_UnionAndTagArguments_NotMatchesTag() throws HiveException {
 when(unionOI.getObjectInspectors()).thenReturn(
   ImmutableList.<ObjectInspector> of(
     PrimitiveObjectInspectorFactory.writableStringObjectInspector,
     PrimitiveObjectInspectorFactory.writableLongObjectInspector));
 when(tagOI.getWritableConstantValue()).thenReturn(new IntWritable(0));
 when(deferredObject.get()).thenReturn(value);
 when(unionOI.getTag(value)).thenReturn((byte) 1);
 underTest.initialize(new ObjectInspector[] { unionOI, tagOI });
 Object result = underTest.evaluate(new DeferredObject[] { deferredObject });
 assertThat(result, is(nullValue()));
}

代码示例来源:origin: apache/hive

@Test
public void evaluate_UnionAndTagArguments_MatchesTag() throws HiveException {
 when(unionOI.getObjectInspectors()).thenReturn(
   ImmutableList.<ObjectInspector> of(
     PrimitiveObjectInspectorFactory.writableStringObjectInspector,
     PrimitiveObjectInspectorFactory.writableLongObjectInspector));
 when(tagOI.getWritableConstantValue()).thenReturn(new IntWritable(0));
 when(deferredObject.get()).thenReturn(value);
 when(unionOI.getTag(value)).thenReturn((byte) 0);
 when(unionOI.getField(value)).thenReturn("foo");
 underTest.initialize(new ObjectInspector[] { unionOI, tagOI });
 Object result = underTest.evaluate(new DeferredObject[] { deferredObject });
 assertThat(result, is((Object) "foo"));
}

代码示例来源:origin: apache/drill

@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
 if (arguments.length != 2) {
  throw new UDFArgumentLengthException(
   "grouping() requires 2 argument, got " + arguments.length);
 }
 if (arguments[0].getCategory() != Category.PRIMITIVE) {
  throw new UDFArgumentTypeException(0, "The first argument to grouping() must be primitive");
 }
 PrimitiveObjectInspector arg1OI = (PrimitiveObjectInspector) arguments[0];
 if (arg1OI.getPrimitiveCategory() != PrimitiveCategory.INT) {
  throw new UDFArgumentTypeException(0, "The first argument to grouping() must be an integer");
 }
 groupingIdOI = (IntObjectInspector) arguments[0];
 PrimitiveObjectInspector arg2OI = (PrimitiveObjectInspector) arguments[1];
 if (!(arg2OI instanceof WritableConstantIntObjectInspector)) {
  throw new UDFArgumentTypeException(1, "The second argument to grouping() must be a constant");
 }
 index = ((WritableConstantIntObjectInspector)arg2OI).getWritableConstantValue().get();
 return PrimitiveObjectInspectorFactory.writableByteObjectInspector;
}

代码示例来源:origin: apache/drill

throw new UDFArgumentTypeException(1, getFuncName().toUpperCase() + " second argument only takes constant");
 scale = ((WritableConstantIntObjectInspector)scaleOI).getWritableConstantValue().get();
 break;
case LONG:

代码示例来源:origin: apache/hive

case INT:
 if (scaleOI instanceof WritableConstantIntObjectInspector) {
  scale = ((WritableConstantIntObjectInspector)scaleOI).getWritableConstantValue().get();
 } else {
  constantScale = false;

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com