Search in sources :

Example 1 with UnwrapRowContainer

use of org.apache.hadoop.hive.ql.exec.persistence.UnwrapRowContainer in project hive by apache.

the class MapJoinOperator method getValueObjectInspectors.

@Override
protected List<ObjectInspector> getValueObjectInspectors(byte alias, List<ObjectInspector>[] aliasToObjectInspectors) {
    int[] valueIndex = conf.getValueIndex(alias);
    if (valueIndex == null) {
        return super.getValueObjectInspectors(alias, aliasToObjectInspectors);
    }
    List<ObjectInspector> inspectors = aliasToObjectInspectors[alias];
    int bigPos = conf.getPosBigTable();
    Converter[] converters = new Converter[valueIndex.length];
    List<ObjectInspector> valueOI = new ArrayList<ObjectInspector>();
    for (int i = 0; i < valueIndex.length; i++) {
        if (valueIndex[i] >= 0 && !joinKeysObjectInspectors[bigPos].isEmpty()) {
            if (conf.getNoOuterJoin()) {
                valueOI.add(joinKeysObjectInspectors[bigPos].get(valueIndex[i]));
            } else {
                // It is an outer join. We are going to add the inspector from the
                // inner side, but the key value will come from the outer side, so
                // we need to create a converter from inputOI to outputOI.
                valueOI.add(inspectors.get(i));
                converters[i] = ObjectInspectorConverters.getConverter(joinKeysObjectInspectors[bigPos].get(valueIndex[i]), inspectors.get(i));
            }
        } else {
            valueOI.add(inspectors.get(i));
        }
    }
    unwrapContainer[alias] = new UnwrapRowContainer(alias, valueIndex, converters, hasFilter(alias));
    return valueOI;
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) ArrayList(java.util.ArrayList) Converter(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter) UnwrapRowContainer(org.apache.hadoop.hive.ql.exec.persistence.UnwrapRowContainer)

Aggregations

ArrayList (java.util.ArrayList)1 UnwrapRowContainer (org.apache.hadoop.hive.ql.exec.persistence.UnwrapRowContainer)1 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)1 Converter (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter)1