Java Code Examples for org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory#intTypeInfo()
The following examples show how to use
org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory#intTypeInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlurObjectInspectorGenerator.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
private TypeInfo getTypeInfo(String fieldType) { if (fieldType.equals(TEXT) || fieldType.equals(STRING) || fieldType.equals(STORED)) { return TypeInfoFactory.stringTypeInfo; } else if (fieldType.equals(LONG)) { return TypeInfoFactory.longTypeInfo; } else if (fieldType.equals(INT)) { return TypeInfoFactory.intTypeInfo; } else if (fieldType.equals(FLOAT)) { return TypeInfoFactory.floatTypeInfo; } else if (fieldType.equals(DOUBLE)) { return TypeInfoFactory.doubleTypeInfo; } else if (fieldType.equals(DATE)) { return TypeInfoFactory.dateTypeInfo; } else if (fieldType.equals(GEO_POINTVECTOR) || fieldType.equals(GEO_RECURSIVEPREFIX) || fieldType.equals(GEO_TERMPREFIX)) { List<TypeInfo> typeInfos = Arrays.asList((TypeInfo) TypeInfoFactory.floatTypeInfo, (TypeInfo) TypeInfoFactory.floatTypeInfo); return TypeInfoFactory.getStructTypeInfo(Arrays.asList(LATITUDE, LONGITUDE), typeInfos); } // Return string for anything that is not a built in type. return TypeInfoFactory.stringTypeInfo; }
Example 2
Source File: PredicateHandlerTest.java From accumulo-hive-storage-manager with Apache License 2.0 | 6 votes |
@Test public void pushdownTuple() { setup(); ExprNodeDesc column = new ExprNodeColumnDesc(TypeInfoFactory.intTypeInfo, "field1", null, false); ExprNodeDesc constant = new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo, 5); List<ExprNodeDesc> children = Lists.newArrayList(); children.add(column); children.add(constant); ExprNodeDesc node = new ExprNodeGenericFuncDesc(TypeInfoFactory.stringTypeInfo, new GenericUDFOPEqual(), children); assertNotNull(node); String filterExpr = Utilities.serializeExpression(node); conf.set(TableScanDesc.FILTER_EXPR_CONF_STR, filterExpr); try { List<IndexSearchCondition> sConditions = handler.getSearchConditions(conf); assertEquals(sConditions.size(), 1); AccumuloPredicateHandler.PushdownTuple tuple = new AccumuloPredicateHandler.PushdownTuple(sConditions.get(0)); byte [] expectedVal = new byte[4]; ByteBuffer.wrap(expectedVal).putInt(5); assertEquals(tuple.getConstVal(), expectedVal); assertEquals(tuple.getcOpt().getClass(), Equal.class); assertEquals(tuple.getpCompare().getClass(), IntCompare.class); } catch (Exception e) { fail(StringUtils.stringifyException(e)); } }
Example 3
Source File: PredicateHandlerTest.java From accumulo-hive-storage-manager with Apache License 2.0 | 5 votes |
@Test public void ignoreIteratorPushdown() { setup(); conf.set(serdeConstants.LIST_COLUMNS, "field1,field2,rid"); conf.set(serdeConstants.LIST_COLUMN_TYPES, "string,int,string"); conf.set(AccumuloSerde.COLUMN_MAPPINGS, "cf|f1,cf|f2,rowID"); ExprNodeDesc column = new ExprNodeColumnDesc(TypeInfoFactory.stringTypeInfo, "field1", null, false); ExprNodeDesc constant = new ExprNodeConstantDesc(TypeInfoFactory.stringTypeInfo, "aaa"); List<ExprNodeDesc> children = Lists.newArrayList(); children.add(column); children.add(constant); ExprNodeDesc node = new ExprNodeGenericFuncDesc(TypeInfoFactory.stringTypeInfo, new GenericUDFOPEqualOrLessThan(), children); assertNotNull(node); ExprNodeDesc column2 = new ExprNodeColumnDesc(TypeInfoFactory.intTypeInfo, "field2", null, false); ExprNodeDesc constant2 = new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo, 5); List<ExprNodeDesc> children2 = Lists.newArrayList(); children2.add(column2); children2.add(constant2); ExprNodeDesc node2 = new ExprNodeGenericFuncDesc(TypeInfoFactory.stringTypeInfo, new GenericUDFOPGreaterThan(), children2); assertNotNull(node2); List<ExprNodeDesc> bothFilters = Lists.newArrayList(); bothFilters.add(node); bothFilters.add(node2); ExprNodeDesc both = new ExprNodeGenericFuncDesc(TypeInfoFactory.stringTypeInfo, new GenericUDFOPAnd(), bothFilters); String filterExpr = Utilities.serializeExpression(both); conf.set(TableScanDesc.FILTER_EXPR_CONF_STR, filterExpr); conf.setBoolean(AccumuloSerde.NO_ITERATOR_PUSHDOWN, true); try { List<IteratorSetting> iterators = handler.getIterators(conf); assertEquals(iterators.size(), 0); } catch (Exception e) { fail(StringUtils.stringifyException(e)); } }
Example 4
Source File: HiveTypeUtil.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeInfo visit(IntType intType) { return TypeInfoFactory.intTypeInfo; }
Example 5
Source File: HiveInspectors.java From flink with Apache License 2.0 | 4 votes |
public static ObjectInspector getObjectInspector(Class clazz) { TypeInfo typeInfo; if (clazz.equals(String.class) || clazz.equals(Text.class)) { typeInfo = TypeInfoFactory.stringTypeInfo; } else if (clazz.equals(Boolean.class) || clazz.equals(BooleanWritable.class)) { typeInfo = TypeInfoFactory.booleanTypeInfo; } else if (clazz.equals(Byte.class) || clazz.equals(ByteWritable.class)) { typeInfo = TypeInfoFactory.byteTypeInfo; } else if (clazz.equals(Short.class) || clazz.equals(ShortWritable.class)) { typeInfo = TypeInfoFactory.shortTypeInfo; } else if (clazz.equals(Integer.class) || clazz.equals(IntWritable.class)) { typeInfo = TypeInfoFactory.intTypeInfo; } else if (clazz.equals(Long.class) || clazz.equals(LongWritable.class)) { typeInfo = TypeInfoFactory.longTypeInfo; } else if (clazz.equals(Float.class) || clazz.equals(FloatWritable.class)) { typeInfo = TypeInfoFactory.floatTypeInfo; } else if (clazz.equals(Double.class) || clazz.equals(DoubleWritable.class)) { typeInfo = TypeInfoFactory.doubleTypeInfo; } else if (clazz.equals(Date.class) || clazz.equals(DateWritable.class)) { typeInfo = TypeInfoFactory.dateTypeInfo; } else if (clazz.equals(Timestamp.class) || clazz.equals(TimestampWritable.class)) { typeInfo = TypeInfoFactory.timestampTypeInfo; } else if (clazz.equals(byte[].class) || clazz.equals(BytesWritable.class)) { typeInfo = TypeInfoFactory.binaryTypeInfo; } else if (clazz.equals(HiveChar.class) || clazz.equals(HiveCharWritable.class)) { typeInfo = TypeInfoFactory.charTypeInfo; } else if (clazz.equals(HiveVarchar.class) || clazz.equals(HiveVarcharWritable.class)) { typeInfo = TypeInfoFactory.varcharTypeInfo; } else if (clazz.equals(HiveDecimal.class) || clazz.equals(HiveDecimalWritable.class)) { typeInfo = TypeInfoFactory.decimalTypeInfo; } else { throw new FlinkHiveUDFException( String.format("Class %s is not supported yet", clazz.getName())); } return getObjectInspector(typeInfo); }
Example 6
Source File: HiveTypeUtil.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeInfo visit(IntType intType) { return TypeInfoFactory.intTypeInfo; }
Example 7
Source File: OrcLazyIntObjectInspector.java From hive-dwrf with Apache License 2.0 | 4 votes |
@SuppressWarnings({"override", "UnusedDeclaration", "RedundantCast"}) // FB Hive public PrimitiveTypeInfo getTypeInfo() { return (PrimitiveTypeInfo) TypeInfoFactory.intTypeInfo; }