private void filterMapworkProperties(Kryo kryo, MapWork mapWork) {
      Configuration configuration = ((KryoWithHooks) kryo).getConf();
      if (configuration == null || HiveConf
          .getVar(configuration, HiveConf.ConfVars.HIVE_PLAN_MAPWORK_SERIALIZATION_SKIP_PROPERTIES).isEmpty()) {
        return;
      }
      String[] filterProps =
          HiveConf.getVar(configuration, HiveConf.ConfVars.HIVE_PLAN_MAPWORK_SERIALIZATION_SKIP_PROPERTIES).split(",");
      for (String prop : filterProps) {
        boolean isRegex = isRegex(prop);
        Pattern pattern = Pattern.compile(prop);

        LOG.debug("Trying to filter MapWork properties (regex: " + isRegex + "): " + prop);

        for (Entry<Path, PartitionDesc> partDescEntry : mapWork.getPathToPartitionInfo().entrySet()) {
          /*
           * remove by regex, could be a bit more expensive because of iterating and matching regexes
           * e.g.: in case of impala_intermediate_stats_chunk1, impala_intermediate_stats_chunk2, user only needs to
           * configure impala_intermediate_stats_chunk.*
           */
          if (isRegex) {
            Iterator<Entry<Object, Object>> itProps =
                partDescEntry.getValue().getProperties().entrySet().iterator();
            while (itProps.hasNext()) {
              Map.Entry<Object, Object> entry = itProps.next();
              String actualProp = (String) entry.getKey();
              Matcher matcher = pattern.matcher(actualProp);

              if (matcher.find()) {
                LOG.debug("Removed '{}' from MapWork (partition: {})", actualProp, partDescEntry.getKey());
                itProps.remove();
              }
            }
          } else {
            Object objRemoved = partDescEntry.getValue().getProperties().remove(prop);
            if (objRemoved != null) {
              LOG.debug("Removed '{}' from MapWork (partition: {})", prop, partDescEntry.getKey());
            }
          }
        }
      }
    }
We use a custom {@link com.esotericsoftware.kryo.Serializer} for {@link MapWork} objects e.g. in
order to remove useless properties in execution time.
ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java