private static VectorExpressionWriter genVectorExpressionWritableMap(
      SettableMapObjectInspector fieldObjInspector) throws HiveException {

    return new VectorExpressionWriterMap() {
      private Object obj;
      private VectorExtractRow vectorExtractRow;
      private MapTypeInfo mapTypeInfo;

      public VectorExpressionWriter init(SettableMapObjectInspector objInspector) throws HiveException {
        super.init(objInspector);
        obj = initValue(null);
        vectorExtractRow = new VectorExtractRow();
        mapTypeInfo = (MapTypeInfo)
            TypeInfoUtils.getTypeInfoFromTypeString(objInspector.getTypeName());
        return this;
      }

      @Override
      public Object initValue(Object ignored) {
        return ((SettableMapObjectInspector) this.objectInspector).create();
      }

      @Override
      public Object writeValue(ColumnVector column, int row)
          throws HiveException {
        final MapColumnVector mapColVector = (MapColumnVector) column;
        final SettableMapObjectInspector mapOI =
            (SettableMapObjectInspector) this.objectInspector;
        final Map<Object, Object> value =
            (Map<Object, Object>) vectorExtractRow.extractRowColumn(
                mapColVector, mapTypeInfo, mapOI, row);
        if (value == null) {
          return null;
        }

        mapOI.clear(obj);
        for (Map.Entry<Object, Object> entry : value.entrySet()) {
          mapOI.put(obj, entry.getKey(), entry.getValue());
        }
        return obj;
      }

      @Override
      public Object setValue(Object map, ColumnVector column, int row)
          throws HiveException {
        if (map == null) {
          map = initValue(null);
        }

        final MapColumnVector mapColVector = (MapColumnVector) column;
        final SettableMapObjectInspector mapOI =
            (SettableMapObjectInspector) this.objectInspector;
        final Map<Object, Object> value =
            (Map<Object, Object>) vectorExtractRow.extractRowColumn(
                mapColVector, mapTypeInfo, mapOI, row);
        if (value == null) {
          return null;
        }

        mapOI.clear(map);
        for (Map.Entry<Object, Object> entry : value.entrySet()) {
          mapOI.put(map, entry.getKey(), entry.getValue());
        }
        return map;
      }
    }.init(fieldObjInspector);
  }
Compiles the appropriate vector expression writers based on a struct object
inspector.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java