本文整理汇总了Java中org.apache.hadoop.hive.ql.udf.UDFLike类的典型用法代码示例。如果您正苦于以下问题:Java UDFLike类的具体用法?Java UDFLike怎么用?Java UDFLike使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UDFLike类属于org.apache.hadoop.hive.ql.udf包,在下文中一共展示了UDFLike类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRegexpExecuter
import org.apache.hadoop.hive.ql.udf.UDFLike; //导入依赖的package包/类
public static IExpressionNode getRegexpExecuter(final ExprNodeConstantDesc constDesc , final IExtractNode targetColumn ){
ObjectInspector objectInspector = constDesc.getWritableObjectInspector();
if( objectInspector.getCategory() != ObjectInspector.Category.PRIMITIVE ){
return null;
}
PrimitiveObjectInspector primitiveObjectInspector = (PrimitiveObjectInspector)objectInspector;
IFilter filter = null;
switch( primitiveObjectInspector.getPrimitiveCategory() ){
case STRING:
String regexp = UDFLike.likePatternToRegExp( ( (WritableConstantStringObjectInspector)primitiveObjectInspector ).getWritableConstantValue().toString() );
filter = new RegexpMatchStringFilter( "^" + regexp + "$" );
break;
case BINARY:
case BOOLEAN:
case BYTE:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:
case DATE:
case DECIMAL:
case TIMESTAMP:
case VOID:
default:
filter = null;
break;
}
if( filter == null ){
return null;
}
return new ExecuterNode( targetColumn , filter );
}
示例2: newPredicate
import org.apache.hadoop.hive.ql.udf.UDFLike; //导入依赖的package包/类
/**
* Create new {@link MPredicateHolder} that maps Hive {@link IndexSearchCondition} to
* Monarch understandable format.
*
* @param columnIndexMap the column to index map
* @param isc the index-search-condition
* @return the mapped predicate
*/
private static MPredicateHolder newPredicate(final Map<String, Integer> columnIndexMap,
final IndexSearchCondition isc) {
Object constantValue = isc.getConstantDesc().getValue();
/** convert SQL like query to Java-regex syntax **/
if (CompareOp.REGEX.equals(FUNC_HIVE_TO_MONARC_MAP.get(isc.getComparisonOp()))) {
constantValue = UDFLike.likePatternToRegExp(constantValue.toString());
} else {
constantValue = convertObject(isc.getConstantDesc().getTypeInfo(),
isc.getColumnDesc().getTypeInfo(), constantValue);
}
return new MPredicateHolder(columnIndexMap.get(isc.getColumnDesc().getColumn()),
MonarchPredicateHandler.getMonarchFieldType(isc.getColumnDesc().getTypeString()),
FUNC_HIVE_TO_MONARC_MAP.get(isc.getComparisonOp()), constantValue);
}
示例3: newFilter
import org.apache.hadoop.hive.ql.udf.UDFLike; //导入依赖的package包/类
/**
* Create new {@link Filter} that maps Hive {@link IndexSearchCondition} to
* Monarch understandable format.
*
* @param isc the index-search-condition
* @return the mapped predicate
*/
private static Filter newFilter(final IndexSearchCondition isc) {
Object constantValue = isc.getConstantDesc().getValue();
/** convert SQL like query to Java-regex syntax **/
if (CompareOp.REGEX.equals(FUNC_HIVE_TO_MONARC_MAP.get(isc.getComparisonOp()))) {
constantValue = UDFLike.likePatternToRegExp(constantValue.toString());
} else {
constantValue = convertObject(isc.getConstantDesc().getTypeInfo(),
isc.getColumnDesc().getTypeInfo(), constantValue);
}
Filter filter = new SingleColumnValueFilter(isc.getColumnDesc().getColumn(),
(CompareOp) FUNC_HIVE_TO_MONARC_MAP.get(isc.getComparisonOp()) , constantValue);
return filter;
}
示例4: getFromUdfClassName
import org.apache.hadoop.hive.ql.udf.UDFLike; //导入依赖的package包/类
public static IHiveExprNode getFromUdfClassName( final Class<? extends UDF> udf , final List<ExprNodeDesc> childNodeDesc ){
if( UDFLike.class.getName() == udf.getName() ){
return new RegexpHiveExpr( childNodeDesc );
}
return new UnsupportHiveExpr();
}