public static boolean isSupportedKey(ObjectInspector keyOi) { List<? extends StructField> keyFields = ((StructObjectInspector) keyOi).getAllStructFieldRefs(); for (StructField field : keyFields) { if (!MapJoinKey.isSupportedField(field.getFieldObjectInspector())) { return false; } } return true; }
@Override public JoinUtil.JoinResult setFromRow( Object row, List<ExprNodeEvaluator> fields, List<ObjectInspector> ois) throws HiveException { if (nulls == null) { nulls = new boolean[fields.size()]; currentKey = new Object[fields.size()]; } for (int keyIndex = 0; keyIndex < fields.size(); ++keyIndex) { currentKey[keyIndex] = fields.get(keyIndex).evaluate(row); nulls[keyIndex] = currentKey[keyIndex] == null; } return currentValue.setFromOutput( MapJoinKey.serializeRow(output, currentKey, ois, sortableSortOrders)); }
@Override public JoinUtil.JoinResult setFromVector( VectorHashKeyWrapper kw, VectorExpressionWriter[] keyOutputWriters, VectorHashKeyWrapperBatch keyWrapperBatch) throws HiveException { if (nulls == null) { nulls = new boolean[keyOutputWriters.length]; currentKey = new Object[keyOutputWriters.length]; vectorKeyOIs = new ArrayList<ObjectInspector>(); for (int i = 0; i < keyOutputWriters.length; i++) { vectorKeyOIs.add(keyOutputWriters[i].getObjectInspector()); } } else { assert nulls.length == keyOutputWriters.length; } for (int i = 0; i < keyOutputWriters.length; i++) { currentKey[i] = keyWrapperBatch.getWritableKeyValue(kw, i, keyOutputWriters[i]); nulls[i] = currentKey[i] == null; } return currentValue.setFromOutput( MapJoinKey.serializeRow(output, currentKey, vectorKeyOIs, sortableSortOrders)); }