Java Code Examples for org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector#equals()

The following examples show how to use org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector#equals() . 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
public Object getUnderlyingDataForObjectInspector(ObjectInspector oi) {
  if (oi.equals(getUnderlyingObjectInspector())) {
    return getUnderlyingData();
  }

  Object result = getObjectFromCache(oi);
  if (result == null) {
    Converter c = ((HiveFactory) _stdFactory).getConverter(getUnderlyingObjectInspector(), oi);
    result = c.convert(getUnderlyingData());
    _cachedObjectsForObjectInspectors.putIfAbsent(oi, result);
  }
  return result;
}
 
Example 2
/**
 * Returns a converter that converts objects from one OI to another OI. The
 * returned (converted) object does not belong to the converter. Hence once convertor can be used
 * multiple times within one eval invocation.
 */
public Converter getConverter(ObjectInspector inputOI, ObjectInspector outputOI) {
  // If the inputOI is the same as the outputOI, just return an
  // IdentityConverter.
  if (inputOI.equals(outputOI)) {
    return new ObjectInspectorConverters.IdentityConverter();
  }
  Converter c = getConverterFromCache(inputOI, outputOI);
  if (c != null) {
    return c;
  }
  switch (outputOI.getCategory()) {
    case PRIMITIVE:
      return getConverter((PrimitiveObjectInspector) inputOI, (PrimitiveObjectInspector) outputOI);
    case STRUCT:
      c = new StructConverter(inputOI, (SettableStructObjectInspector) outputOI);
      break;
    case LIST:
      c = new ListConverter(inputOI, (SettableListObjectInspector) outputOI);
      break;
    case MAP:
      c = new MapConverter(inputOI, (SettableMapObjectInspector) outputOI);
      break;
    default:
      throw new UnsupportedOperationException(
          "Hive internal error: conversion of " + inputOI.getTypeName() + " to " + outputOI.getTypeName()
              + " not supported yet.");
  }
  cacheConverter(inputOI, outputOI, c);
  return c;
}
 
Example 3
@Override
public boolean equals(final Object o) {
  if (o == null || o.getClass() != getClass()) {
    return false;
  } else if (o == this) {
    return true;
  } else {
    final ObjectInspector other = ((ParquetHiveArrayInspector) o).arrayElementInspector;
    return other.equals(arrayElementInspector);
  }
}
 
Example 4
Source Project: spork   File: OrcUtils.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (o == null || o.getClass() != getClass()) {
        return false;
    } else if (o == this) {
        return true;
    } else {
        ObjectInspector other = ((PigListObjectInspector) o).child;
        return other.equals(child);
    }
}
 
Example 5
@Override
public boolean equals(Object o) {
  if (o == null || o.getClass() != getClass()) {
    return false;
  } else if (o == this) {
    return true;
  } else {
    ObjectInspector other = ((OrcLazyListObjectInspector) o).child;
    return other.equals(child);
  }
}
 
Example 6
Source Project: hive-dwrf   File: OrcStruct.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == null || o.getClass() != getClass()) {
    return false;
  } else if (o == this) {
    return true;
  } else {
    ObjectInspector other = ((OrcListObjectInspector) o).child;
    return other.equals(child);
  }
}