本文整理汇总了Java中org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory.javaLongObjectInspector方法的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveObjectInspectorFactory.javaLongObjectInspector方法的具体用法?Java PrimitiveObjectInspectorFactory.javaLongObjectInspector怎么用?Java PrimitiveObjectInspectorFactory.javaLongObjectInspector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory
的用法示例。
在下文中一共展示了PrimitiveObjectInspectorFactory.javaLongObjectInspector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFeatureOutputOI
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Nonnull
protected final ObjectInspector getFeatureOutputOI(@Nonnull final FeatureType featureType)
throws UDFArgumentException {
final PrimitiveObjectInspector outputOI;
if (dense_model) {
// TODO validation
outputOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector; // see DenseModel (long/string is also parsed as int)
} else {
switch (featureType) {
case STRING:
outputOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
break;
case INT:
outputOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
break;
case LONG:
outputOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
break;
default:
throw new IllegalStateException("Unexpected feature type: " + featureType);
}
}
return outputOI;
}
示例2: testInitialize
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testInitialize() throws UDFArgumentException {
PassiveAggressiveUDTF udtf = new PassiveAggressiveUDTF();
ObjectInspector intOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
ListObjectInspector intListOI = ObjectInspectorFactory.getStandardListObjectInspector(intOI);
/* test for INT_TYPE_NAME feature */
StructObjectInspector intListSOI = udtf.initialize(new ObjectInspector[] {intListOI, intOI});
assertEquals("struct<feature:int,weight:float>", intListSOI.getTypeName());
/* test for STRING_TYPE_NAME feature */
ObjectInspector stringOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ListObjectInspector stringListOI = ObjectInspectorFactory.getStandardListObjectInspector(stringOI);
StructObjectInspector stringListSOI = udtf.initialize(new ObjectInspector[] {stringListOI,
intOI});
assertEquals("struct<feature:string,weight:float>", stringListSOI.getTypeName());
/* test for BIGINT_TYPE_NAME feature */
ObjectInspector longOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ListObjectInspector longListOI = ObjectInspectorFactory.getStandardListObjectInspector(longOI);
StructObjectInspector longListSOI = udtf.initialize(new ObjectInspector[] {longListOI,
intOI});
assertEquals("struct<feature:bigint,weight:float>", longListSOI.getTypeName());
}
示例3: testInitialize
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testInitialize() throws UDFArgumentException {
PerceptronUDTF udtf = new PerceptronUDTF();
ObjectInspector intOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
ListObjectInspector intListOI = ObjectInspectorFactory.getStandardListObjectInspector(intOI);
/* test for INT_TYPE_NAME feature */
StructObjectInspector intListSOI = udtf.initialize(new ObjectInspector[] {intListOI, intOI});
assertEquals("struct<feature:int,weight:float>", intListSOI.getTypeName());
/* test for STRING_TYPE_NAME feature */
ObjectInspector stringOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ListObjectInspector stringListOI = ObjectInspectorFactory.getStandardListObjectInspector(stringOI);
StructObjectInspector stringListSOI = udtf.initialize(new ObjectInspector[] {stringListOI,
intOI});
assertEquals("struct<feature:string,weight:float>", stringListSOI.getTypeName());
/* test for BIGINT_TYPE_NAME feature */
ObjectInspector longOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ListObjectInspector longListOI = ObjectInspectorFactory.getStandardListObjectInspector(longOI);
StructObjectInspector longListSOI = udtf.initialize(new ObjectInspector[] {longListOI,
intOI});
assertEquals("struct<feature:bigint,weight:float>", longListSOI.getTypeName());
}
示例4: testIntLong
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testIntLong() throws Exception {
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
ObjectInspector weightOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
udf.initialize(new ObjectInspector[] {featureOI, weightOI});
Text ret = udf.evaluate(new GenericUDF.DeferredObject[] {new DeferredJavaObject(1),
new DeferredJavaObject(2L)});
Assert.assertEquals("1:2", ret.toString());
}
示例5: testLongInt
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testLongInt() throws Exception {
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ObjectInspector weightOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
udf.initialize(new ObjectInspector[] {featureOI, weightOI});
Text ret = udf.evaluate(new GenericUDF.DeferredObject[] {new DeferredJavaObject(1L),
new DeferredJavaObject(2)});
Assert.assertEquals("1:2", ret.toString());
}
示例6: testLongLong
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testLongLong() throws Exception {
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ObjectInspector weightOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
udf.initialize(new ObjectInspector[] {featureOI, weightOI});
Text ret = udf.evaluate(new GenericUDF.DeferredObject[] {new DeferredJavaObject(1L),
new DeferredJavaObject(2L)});
Assert.assertEquals("1:2", ret.toString());
}
示例7: getObjectInspector
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
public static ObjectInspector getObjectInspector(Type kuduType,
String hiveType) throws SerDeException {
switch (kuduType) {
case STRING:
return PrimitiveObjectInspectorFactory.javaStringObjectInspector;
case FLOAT:
return PrimitiveObjectInspectorFactory.javaFloatObjectInspector;
case DOUBLE:
return PrimitiveObjectInspectorFactory.javaDoubleObjectInspector;
case BOOL:
return PrimitiveObjectInspectorFactory.javaBooleanObjectInspector;
case INT8:
return PrimitiveObjectInspectorFactory.javaByteObjectInspector;
case INT16:
return PrimitiveObjectInspectorFactory.javaShortObjectInspector;
case INT32:
return PrimitiveObjectInspectorFactory.javaIntObjectInspector;
case INT64:
return PrimitiveObjectInspectorFactory.javaLongObjectInspector;
case TIMESTAMP:
return PrimitiveObjectInspectorFactory.javaTimestampObjectInspector;
case BINARY:
return PrimitiveObjectInspectorFactory.javaByteArrayObjectInspector;
default:
throw new SerDeException("Cannot find getObjectInspector for: "
+ hiveType);
}
}
示例8: testLongDouble
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testLongDouble() throws Exception {
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ObjectInspector weightOI = PrimitiveObjectInspectorFactory.javaDoubleObjectInspector;
udf.initialize(new ObjectInspector[] {featureOI, weightOI});
Text ret = udf.evaluate(new GenericUDF.DeferredObject[] {new DeferredJavaObject(1L),
new DeferredJavaObject(2.5d)});
Assert.assertEquals("1:2.5", ret.toString());
}
示例9: testStringLong
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testStringLong() throws Exception {
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ObjectInspector weightOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
udf.initialize(new ObjectInspector[] {featureOI, weightOI});
Text ret = udf.evaluate(new GenericUDF.DeferredObject[] {new DeferredJavaObject("f1"),
new DeferredJavaObject(2L)});
Assert.assertEquals("f1:2", ret.toString());
}
示例10: testInitialize
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void testInitialize() throws UDFArgumentException {
AdaGradUDTF udtf = new AdaGradUDTF();
ObjectInspector labelOI = PrimitiveObjectInspectorFactory.javaFloatObjectInspector;
ObjectInspector intOI = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
ListObjectInspector intListOI = ObjectInspectorFactory.getStandardListObjectInspector(intOI);
/* test for INT_TYPE_NAME feature */
StructObjectInspector intListSOI = udtf.initialize(new ObjectInspector[] {intListOI,
labelOI});
assertEquals("struct<feature:int,weight:float>", intListSOI.getTypeName());
/* test for STRING_TYPE_NAME feature */
ObjectInspector stringOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ListObjectInspector stringListOI = ObjectInspectorFactory.getStandardListObjectInspector(stringOI);
StructObjectInspector stringListSOI = udtf.initialize(new ObjectInspector[] {stringListOI,
labelOI});
assertEquals("struct<feature:string,weight:float>", stringListSOI.getTypeName());
/* test for BIGINT_TYPE_NAME feature */
ObjectInspector longOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
ListObjectInspector longListOI = ObjectInspectorFactory.getStandardListObjectInspector(longOI);
StructObjectInspector longListSOI = udtf.initialize(new ObjectInspector[] {longListOI,
labelOI});
assertEquals("struct<feature:bigint,weight:float>", longListSOI.getTypeName());
}
示例11: testInvalidNumberOfParams
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test(expected = UDFArgumentLengthException.class)
public void testInvalidNumberOfParams() throws HiveException {
Funnel udaf = new Funnel();
ObjectInspector[] inputObjectInspectorList = new ObjectInspector[]{
PrimitiveObjectInspectorFactory.javaLongObjectInspector
};
GenericUDAFParameterInfo paramInfo = new SimpleGenericUDAFParameterInfo(inputObjectInspectorList, false, false);
GenericUDAFEvaluator udafEvaluator = udaf.getEvaluator(paramInfo);
}
示例12: testNonmatchingParamPosition4
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test(expected = UDFArgumentTypeException.class)
public void testNonmatchingParamPosition4() throws HiveException {
Funnel udaf = new Funnel();
ObjectInspector[] inputObjectInspectorList = new ObjectInspector[]{
PrimitiveObjectInspectorFactory.javaStringObjectInspector,
PrimitiveObjectInspectorFactory.javaStringObjectInspector,
PrimitiveObjectInspectorFactory.javaStringObjectInspector,
PrimitiveObjectInspectorFactory.javaLongObjectInspector
};
GenericUDAFParameterInfo paramInfo = new SimpleGenericUDAFParameterInfo(inputObjectInspectorList, false, false);
GenericUDAFEvaluator udafEvaluator = udaf.getEvaluator(paramInfo);
}
示例13: testBadInputType
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test(expected = UDFArgumentTypeException.class)
public void testBadInputType() throws HiveException {
Fallout udf = new Fallout();
ObjectInspector[] inputOiList = new ObjectInspector[]{
PrimitiveObjectInspectorFactory.javaLongObjectInspector
};
udf.initialize(inputOiList);
}
示例14: testBadInputType
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test(expected = UDFArgumentTypeException.class)
public void testBadInputType() throws HiveException {
Conversion udf = new Conversion();
ObjectInspector[] inputOiList = new ObjectInspector[]{
PrimitiveObjectInspectorFactory.javaLongObjectInspector
};
udf.initialize(inputOiList);
}
示例15: testLongFeature
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //导入方法依赖的package包/类
@Test
public void testLongFeature() throws Exception {
List<Long> x = Arrays.asList(111L, 222L);
ObjectInspector featureOI = PrimitiveObjectInspectorFactory.javaLongObjectInspector;
testFeature(x, featureOI, Long.class, Long.class);
}