当前位置: 首页>>代码示例>>Java>>正文


Java UDFLike类代码示例

本文整理汇总了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 );
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:34,代码来源:RegexpHiveExpr.java

示例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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:MonarchPredicateHandler.java

示例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;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:22,代码来源:MonarchPredicateHandler.java

示例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();  
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:7,代码来源:HiveExprFactory.java


注:本文中的org.apache.hadoop.hive.ql.udf.UDFLike类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。