Java Code Examples for org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector#PrimitiveCategory

The following examples show how to use org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector#PrimitiveCategory . 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: InHiveExpr.java    From multiple-dimension-spread with Apache License 2.0 5 votes vote down vote up
public static IFilter getEqualsExecuter( final List<ExprNodeDesc> nodeDescList , final int start ){
  PrimitiveObjectInspector rootPrimitiveObjectInspector = getPrimitiveObjectInspector( nodeDescList.get( start ) );
  if( rootPrimitiveObjectInspector == null ){
    return null;
  }
  PrimitiveObjectInspector.PrimitiveCategory primitiveCategory = rootPrimitiveObjectInspector.getPrimitiveCategory();
  IFilter filter = null;
  switch( rootPrimitiveObjectInspector.getPrimitiveCategory() ){
    case STRING:
      Set<String> stringDic = new HashSet<String>();
      for( int i = start ; i < nodeDescList.size() ; i++ ){
        PrimitiveObjectInspector primitiveObjectInspector  = getPrimitiveObjectInspector( nodeDescList.get( i ) );
        if( primitiveObjectInspector == null || primitiveObjectInspector.getPrimitiveCategory() != rootPrimitiveObjectInspector.getPrimitiveCategory() ){
          return null;
        }
        stringDic.add( ( (WritableConstantStringObjectInspector)primitiveObjectInspector ).getWritableConstantValue().toString() );
      }
      return new StringDictionaryFilter( stringDic );
    case BYTE:
    case SHORT:
    case INT:
    case LONG:
    case FLOAT:
    case DOUBLE:
    default:
      return null;
  }
}
 
Example 2
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws UDFArgumentTypeException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as parameter "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
Example 3
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws UDFArgumentTypeException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as parameter "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
Example 4
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws SemanticException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as the argument "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
Example 5
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws SemanticException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as the argument "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
Example 6
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws UDFArgumentTypeException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as parameter "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
Example 7
Source File: ObjectInspectorValidator.java    From incubator-datasketches-hive with Apache License 2.0 5 votes vote down vote up
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws UDFArgumentTypeException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as parameter "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}