private void parse() {
    parsed = true;

    byte itemSeparator = oi.getItemSeparator();
    byte keyValueSeparator = oi.getKeyValueSeparator();
    boolean isEscaped = oi.isEscaped();
    byte escapeChar = oi.getEscapeChar();

    // empty array?
    if (length == 0) {
      mapSize = 0;
      return;
    }

    mapSize = 0;
    int arrayByteEnd = start + length;
    int elementByteBegin = start;
    int keyValueSeparatorPosition = -1;
    int elementByteEnd = start;
    byte[] bytes = this.bytes.getData();
    Set<Object> keySet = new LinkedHashSet<Object>();

    // Go through all bytes in the byte[]
    while (elementByteEnd <= arrayByteEnd) {
      // End of entry reached?
      if (elementByteEnd == arrayByteEnd
          || bytes[elementByteEnd] == itemSeparator) {
        // Array full?
        if (keyStart == null || mapSize + 1 == keyStart.length) {
          enlargeArrays();
        }
        keyStart[mapSize] = elementByteBegin;
        // If no keyValueSeparator is seen, all bytes belong to key, and
        // value will be NULL.
        keyEnd[mapSize] = (keyValueSeparatorPosition == -1 ? elementByteEnd
            : keyValueSeparatorPosition);
        valueLength[mapSize] = elementByteEnd - (keyEnd[mapSize] + 1);
        LazyPrimitive<?, ?> lazyKey = uncheckedGetKey(mapSize);
        if (lazyKey == null) {
          LOG.warn("skipped empty entry or entry with empty key in the representation of column with MAP type.");
          //reset keyInited[mapSize] flag, since it may be set to true in the case of previous empty entry
          keyInited[mapSize] = false;
        } else {
          Object key = lazyKey.getObject();
          if(!keySet.contains(key)) {
            mapSize++;
            keySet.add(key);
          } else {
            keyInited[mapSize] = false;
          }
        }

        // reset keyValueSeparatorPosition
        keyValueSeparatorPosition = -1;
        elementByteBegin = elementByteEnd + 1;
        elementByteEnd++;
      } else {
        // Is this the first keyValueSeparator in this entry?
        if (keyValueSeparatorPosition == -1
            && bytes[elementByteEnd] == keyValueSeparator) {
          keyValueSeparatorPosition = elementByteEnd;
        }
        if (isEscaped && bytes[elementByteEnd] == escapeChar
            && elementByteEnd + 1 < arrayByteEnd) {
          // ignore the char after escape_char
          elementByteEnd += 2;
        } else {
          elementByteEnd++;
        }
      }
    }

    // This makes sure we can use the same formula to compute the
    // length of each value in the map.
    keyStart[mapSize] = arrayByteEnd + 1;

    if (mapSize > 0) {
      Arrays.fill(valueInited, 0, mapSize, false);
    }
  }
Parse the byte[] and fill keyStart, keyEnd.
serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyMap.java