Debug with a table key

@param out the result of the debug stream
@param path the database source
@param tableKey the specific table to display
@throws IOException
191825
public void debug(WriteStream out, Path path, byte []tableKey)
    throws IOException
  {
    SegmentKelpBuilder builder = new SegmentKelpBuilder();
    builder.path(path);
    builder.create(false);
    builder.services(ServicesAmp.newManager().get());
    
    SegmentServiceImpl segmentService = builder.build();
    
    for (SegmentExtent extent : segmentService.getSegmentExtents()) {
      debugSegment(out, segmentService, extent, tableKey);
    }
  }
645273
public void read(File file, Table table) throws IOException
   {
      //System.out.println("Reading " + file.getName());
      InputStream is = null;
      try
      {
         is = new FileInputStream(file);
         read(is, table);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }
669508
public static void print(CSTable table, PrintWriter out) {
        out.println(TABLE + "," + CSVParser.printLine(table.getName()));
        for (String key : table.getInfo().keySet()) {
            out.println(CSVParser.printLine(key, table.getInfo().get(key)));
        }
        if (table.getColumnCount() < 1) {
            out.flush();
            return;
        }
        out.print(HEADER);
        for (int i = 1; i <= table.getColumnCount(); i++) {
            out.print("," + table.getColumnName(i));
        }
        out.println();
        Map<String, String> m = table.getColumnInfo(1);
        for (String key : m.keySet()) {
            out.print(key);
            for (int i = 1; i <= table.getColumnCount(); i++) {
                out.print("," + table.getColumnInfo(i).get(key));
            }
            out.println();
        }
        for (String[] row : table.rows()) {
            for (int i = 1; i < row.length; i++) {
                out.print("," + row[i]);
            }
            out.println();
        }
        out.println();
        out.flush();
    }
1348206
def write_debug_log(self, file_path):
        
        with open(file_path, "wb+") as fh:
            fh.write(system.get_system_info().encode('utf-8'))
            # writing to debug stream
            self._debug_stream.seek(0)
            fh.write(self._debug_stream.read().encode('utf-8'))
            fh.write("The following errors occured:\n".encode('utf-8'))
            for error in self._errors:
                fh.write((error + "\n").encode('utf-8'))
            for k, v in self._error_dict.items():
                if len(v) > 0:
                    fh.write(("Error(s) in %s with formula %s:\n" % k).encode('utf-8'))
                    for error in v:
                        fh.write((error + "\n").encode('utf-8'))
23910
public void clearTableState(String key) {
        Map<String, Object> sessionMap = getFacesContext().getExternalContext().getSessionMap();
        Map<String, TableState> dtState = (Map) sessionMap.get(Constants.TABLE_STATE);
        if (dtState != null) {
            dtState.remove(key);
        }
    }
1285883
protected void __setOutput(String path) {
        try {
            w_ = new BufferedWriter(new FileWriter(path));
        } catch (Exception e) {
            throw new FastRuntimeException(e.getMessage());
        }
    }
628375
private static void fsyncLineage(final Path path) throws IOException {
        Path cursor = path.toRealPath();
        while (cursor != null) {
            fsync(cursor);
            cursor = cursor.getParent();
        }
    }
799267
@SuppressWarnings({ "unchecked", "rawtypes" })
    public <T> void set(PreparedStatement stmt, Path<?> path, int i, T value) throws SQLException {
        if (value == null || value instanceof Null) {
            Integer sqlType = null;
            if (path != null) {
                ColumnMetadata columnMetadata = ColumnMetadata.getColumnMetadata(path);
                if (columnMetadata.hasJdbcType()) {
                    sqlType = columnMetadata.getJdbcType();
                }
            }
            if (sqlType != null) {
                stmt.setNull(i, sqlType);
            } else {
                stmt.setNull(i, Types.NULL);
            }
        } else {
            getType(path, (Class) value.getClass()).setValue(stmt, i, value);
        }
    }
689240
public void debug(Object message, Throwable t)
    {
        if (IS12)
        {
            getLogger().log(FQCN, Level.DEBUG, message, t);
        }
        else
        {
            getLogger().log(FQCN, Level.DEBUG, message, t);
        }
    }
1145038
def export_debug(self, output_path):
        

        file_hash = hashlib.md5(open(output_path, 'rb').read()).hexdigest()
        avm_name = os.path.splitext(os.path.basename(output_path))[0]

        json_data = self.generate_debug_json(avm_name, file_hash)

        mapfilename = output_path.replace('.avm', '.debug.json')
        with open(mapfilename, 'w+') as out_file:
            out_file.write(json_data)
1151187
@SuppressWarnings("unchecked")
    @Override
    public <T> T runScript(String path) throws IOException {
        List<URL> urls = Paths.toURLs(path);
        Object result = null;
        for (URL url : urls) {
            try (Reader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
                result = runScript(reader, url.getPath());
            }
        }
        return (T) result;
    }
322936
@Override
    public void debug(String format, Object arg) {
        if (logger.isDebugEnabled()) {
            FormattingTuple ft = MessageFormatter.format(format, arg);
            logger.debug(ft.getMessage(), ft.getThrowable());
        }
    }
1342801
private function debug($type, $key, $data = null, $result = null)
    {
        $line = strtoupper($type) . ' ' . $key;

        if ($data !== null) {
            $line .= ' ' . ($this->packed ? $data : serialize($data));
        }

        rcube::debug($this->type, $line, $result);
    }
984644
private void debugSegment(WriteStream out, 
                            SegmentServiceImpl segmentService,
                            SegmentExtent extent,
                            byte []debugTableKey)
    throws IOException
  {
    int length = extent.length();
    
    try (InSegment in = segmentService.openRead(extent)) {
      ReadStream is = new ReadStream(in);

      is.position(length - BLOCK_SIZE);

      long seq = BitsUtil.readLong(is);

      if (seq <= 0) {
        return;
      }

      byte []tableKey = new byte[32];
      is.readAll(tableKey, 0, tableKey.length);
      
      TableEntry table = segmentService.findTable(tableKey);

      if (table == null) {
        return;
      }
      
      if (debugTableKey != null && ! Arrays.equals(debugTableKey, tableKey)) {
        return;
      }

      out.println();
      
      StringBuilder sb = new StringBuilder();
      Base64Util.encode(sb, seq);
      long time = _idGen.time(seq);
      
      out.println("Segment: " + extent.getId() + " (seq: " + sb
                  + ", table: " + Hex.toShortHex(tableKey)
                  + ", addr: 0x" + Long.toHexString(extent.address())
                  + ", len: 0x" + Integer.toHexString(length)
                  + ", time: " + LocalDateTime.ofEpochSecond(time / 1000, 0, ZoneOffset.UTC)
                  + ")");
      
      debugSegmentEntries(out, is, extent, table);
    }
  }
1193392
private void readTableIndex(TableEntry10 table)
    throws IOException
  {
    for (Segment10 segment : tableSegments(table)) {
      try (ReadStream is = openRead(segment.address(), segment.length())) {
        readSegmentIndex(is, segment);
      }
    }
  }
1002107
public void map(Object key, Object value, OutputCollector output, Reporter reporter) throws IOException {
    if (outerrThreadsThrowable != null) {
      mapRedFinished();
      throw new IOException ("MROutput/MRErrThread failed:"
                             + StringUtils.stringifyException(
                                                              outerrThreadsThrowable));
    }
    try {
      // 1/4 Hadoop in
      numRecRead_++;
      maybeLogRecord();
      if (debugFailDuring_ && numRecRead_ == 3) {
        throw new IOException("debugFailDuring_");
      }

      // 2/4 Hadoop to Tool
      if (numExceptions_ == 0) {
        if (!this.ignoreKey) {
          write(key);
          clientOut_.write(getInputSeparator());
        }
        write(value);
        if (!ignoreNewLine) {
          clientOut_.write('\n');
        }
        if(skipping) {
          //flush the streams on every record input if running in skip mode
          //so that we don't buffer other records surrounding a bad record. 
          clientOut_.flush();
        }
      } else {
        numRecSkipped_++;
      }
    } catch (IOException io) {
      numExceptions_++;
      if (numExceptions_ > 1 || numRecWritten_ < minRecWrittenToEnableSkip_) {
        // terminate with failure
        String msg = logFailure(io);
        appendLogToJobLog("failure");
        mapRedFinished();
        throw new IOException(msg);
      } else {
        // terminate with success:
        // swallow input records although the stream processor failed/closed
      }
    }
  }
658169
protected void processOutlineCodeField(Integer entityID, Row row)
   {
      processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME"));
   }