use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.shortTypeInfo in project hive by apache.
the class TestVectorAggregation method testCountStar.
@Test
public void testCountStar() throws Exception {
Random random = new Random(7743);
doTests(random, "count", TypeInfoFactory.shortTypeInfo, true, false);
doTests(random, "count", TypeInfoFactory.longTypeInfo, true, false);
doTests(random, "count", TypeInfoFactory.doubleTypeInfo, true, false);
doTests(random, "count", new DecimalTypeInfo(18, 10), true, false);
doTests(random, "count", TypeInfoFactory.stringTypeInfo, true, false);
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.shortTypeInfo in project hive by apache.
the class TestGenericUDFOPMinus method testByteMinusShort.
@Test
public void testByteMinusShort() throws HiveException {
GenericUDFOPMinus udf = new GenericUDFOPMinus();
ByteWritable left = new ByteWritable((byte) 4);
ShortWritable right = new ShortWritable((short) 6);
ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableByteObjectInspector, PrimitiveObjectInspectorFactory.writableShortObjectInspector };
DeferredObject[] args = { new DeferredJavaObject(left), new DeferredJavaObject(right) };
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.shortTypeInfo);
ShortWritable res = (ShortWritable) udf.evaluate(args);
Assert.assertEquals(-2, res.get());
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.shortTypeInfo in project hive by apache.
the class TestGenericUDFOPNegative method testShort.
@Test
public void testShort() throws HiveException {
GenericUDFOPNegative udf = new GenericUDFOPNegative();
ShortWritable input = new ShortWritable((short) 74);
ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableShortObjectInspector };
DeferredObject[] args = { new DeferredJavaObject(input) };
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
Assert.assertEquals(TypeInfoFactory.shortTypeInfo, oi.getTypeInfo());
ShortWritable res = (ShortWritable) udf.evaluate(args);
Assert.assertEquals((short) -74, res.get());
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.shortTypeInfo in project hive by apache.
the class TestGenericUDFOPMultiply method testByteTimesShort.
@Test
public void testByteTimesShort() throws HiveException {
GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
ByteWritable left = new ByteWritable((byte) 4);
ShortWritable right = new ShortWritable((short) 6);
ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableByteObjectInspector, PrimitiveObjectInspectorFactory.writableShortObjectInspector };
DeferredObject[] args = { new DeferredJavaObject(left), new DeferredJavaObject(right) };
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.shortTypeInfo);
ShortWritable res = (ShortWritable) udf.evaluate(args);
Assert.assertEquals(24, res.get());
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.shortTypeInfo in project hive by apache.
the class TestMapJoinOperator method doTestMultiKey2.
public boolean doTestMultiKey2(long seed, int hiveConfVariation, VectorMapJoinVariation vectorMapJoinVariation, MapJoinPlanVariation mapJoinPlanVariation) throws Exception {
int rowCount = 10;
HiveConf hiveConf = new HiveConf();
if (!addNonLongHiveConfVariation(hiveConfVariation, hiveConf)) {
return true;
}
TypeInfo[] bigTableTypeInfos = null;
int[] bigTableKeyColumnNums = null;
TypeInfo[] smallTableValueTypeInfos = null;
int[] smallTableRetainKeyColumnNums = null;
SmallTableGenerationParameters smallTableGenerationParameters = new SmallTableGenerationParameters();
MapJoinTestDescription testDesc = null;
MapJoinTestData testData = null;
// Three key columns.
bigTableTypeInfos = new TypeInfo[] { TypeInfoFactory.longTypeInfo, TypeInfoFactory.shortTypeInfo, TypeInfoFactory.stringTypeInfo };
bigTableKeyColumnNums = new int[] { 0, 1, 2 };
smallTableRetainKeyColumnNums = new int[] { 0, 1, 2 };
smallTableValueTypeInfos = new TypeInfo[] { TypeInfoFactory.stringTypeInfo };
// ----------------------------------------------------------------------------------------------
testDesc = new MapJoinTestDescription(hiveConf, vectorMapJoinVariation, bigTableTypeInfos, bigTableKeyColumnNums, smallTableValueTypeInfos, smallTableRetainKeyColumnNums, smallTableGenerationParameters, mapJoinPlanVariation);
if (!goodTestVariation(testDesc)) {
return false;
}
// Prepare data. Good for ANY implementation variation.
testData = new MapJoinTestData(rowCount, testDesc, seed);
executeTest(testDesc, testData, "testMultiKey0");
return false;
}
Aggregations