@Override
  public String inspect() {
    if (!SchemaFileConfig.DETAIL_SKETCH) {
      return "";
    }

    List<Pair<String, Short>> keyAddressList = getKeyOffsetList();

    // Internal/Entity presents as (name, is_aligned, child_segment_address)
    // Measurement presents as (name, data_type, encoding, compressor, alias_if_exist)
    ByteBuffer bufferR = this.buffer.asReadOnlyBuffer();
    StringBuilder builder = new StringBuilder("");
    builder.append(
        String.format(
            "[length: %d, total_records: %d, spare_size:%d,",
            this.length,
            keyAddressList.size(),
            freeAddr - pairLength - SchemaFileConfig.SEG_HEADER_SIZE));
    bufferR.clear();
    for (Pair<String, Short> pair : keyAddressList) {
      bufferR.position(pair.right + pair.left.getBytes().length + 4);
      if (RecordUtils.getRecordType(bufferR) == 0 || RecordUtils.getRecordType(bufferR) == 1) {
        Boolean isAligned = RecordUtils.getAlignment(bufferR);
        builder.append(
            String.format(
                "(%s, %s, %s),",
                pair.left,
                isAligned == null ? "null" : isAligned ? "aligned" : "not_aligned",
                RecordUtils.getRecordSegAddr(bufferR) == -1
                    ? -1
                    : Long.toHexString(RecordUtils.getRecordSegAddr(bufferR))));
      } else if (RecordUtils.getRecordType(bufferR) == 4) {
        byte[] schemaBytes = RecordUtils.getMeasStatsBytes(bufferR);
        builder.append(
            String.format(
                "(%s, %s, %s, %s, %s),",
                pair.left,
                TSDataType.values()[schemaBytes[0]],
                TSEncoding.values()[schemaBytes[1]],
                CompressionType.deserialize(schemaBytes[2]),
                RecordUtils.getRecordAlias(bufferR)));
      } else if (RecordUtils.getRecordType(bufferR) == 5) {
        int oriPos = bufferR.position();
        bufferR.position(oriPos + 3);
        long of = ReadWriteIOUtils.readLong(bufferR);
        boolean pred = ReadWriteIOUtils.readBool(bufferR);
        ViewExpression viewExpression = ViewExpression.deserialize(bufferR);
        // view
        builder.append(
            String.format("view(%s, %s, %s, %s),", pair.left, of, pred, viewExpression.toString()));
      } else {
        throw new BufferUnderflowException();
      }
    }
    builder.append("]");
    return builder.toString();
  }
@param key
@return -1 if not existed, otherwise correspondent position of target offset
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java