/** * Convert a byte array into a hex string */ public static String toHex(byte[] b) { return toHex(b, 0, b.length); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("tableName=").append(tableName); if (families != null) { sb.append(", families=").append(families); } sb.append(", batchSize=").append(batchSize); sb.append(", numHashFiles=").append(numHashFiles); if (!isTableStartRow(startRow)) { sb.append(", startRowHex=").append(Bytes.toHex(startRow)); } if (!isTableEndRow(stopRow)) { sb.append(", stopRowHex=").append(Bytes.toHex(stopRow)); } if (scanBatch >= 0) { sb.append(", scanBatch=").append(scanBatch); } if (versions >= 0) { sb.append(", versions=").append(versions); } if (startTime != 0) { sb.append("startTime=").append(startTime); } if (endTime != 0) { sb.append("endTime=").append(endTime); } return sb.toString(); }
void writePropertiesFile(FileSystem fs, Path path) throws IOException { Properties p = new Properties(); p.setProperty("table", tableName); if (families != null) { p.setProperty("columnFamilies", families); } p.setProperty("targetBatchSize", Long.toString(batchSize)); p.setProperty("numHashFiles", Integer.toString(numHashFiles)); if (!isTableStartRow(startRow)) { p.setProperty("startRowHex", Bytes.toHex(startRow)); } if (!isTableEndRow(stopRow)) { p.setProperty("stopRowHex", Bytes.toHex(stopRow)); } if (scanBatch > 0) { p.setProperty("scanBatch", Integer.toString(scanBatch)); } if (versions >= 0) { p.setProperty("versions", Integer.toString(versions)); } if (startTime != 0) { p.setProperty("startTimestamp", Long.toString(startTime)); } if (endTime != 0) { p.setProperty("endTimestamp", Long.toString(endTime)); } try (OutputStreamWriter osw = new OutputStreamWriter(fs.create(path), Charsets.UTF_8)) { p.store(osw, null); } }
String byteString = Bytes.toHex((byte[])object); builder.append("'").append(escape(byteString)).append("'"); } else {
private static String toHex(ImmutableBytesWritable bytes) { return Bytes.toHex(bytes.get(), bytes.getOffset(), bytes.getLength()); }
LOG.debug("Different values: "); LOG.debug(" source cell: " + sourceCell + " value: " + Bytes.toHex(sourceCell.getValueArray(), sourceCell.getValueOffset(), sourceCell.getValueLength())); LOG.debug(" target cell: " + targetCell + " value: " + Bytes.toHex(targetCell.getValueArray(), targetCell.getValueOffset(), targetCell.getValueLength()));
ImmutableBytesWritable hash = new ImmutableBytesWritable(); while(reader.next(key, hash)) { String keyString = Bytes.toHex(key.get(), key.getOffset(), key.getLength()); LOG.debug("Key: " + (keyString.isEmpty() ? "-1" : Integer.parseInt(keyString, 16)) + " Hash: " + Bytes.toHex(hash.get(), hash.getOffset(), hash.getLength()));
/** * Convert a byte array into a hex string */ public static String toHex(byte[] b) { return toHex(b, 0, b.length); }
/** * Convert a byte array into a hex string */ public static String toHex(byte[] b) { return toHex(b, 0, b.length); }
/** * Convert a byte array into a hex string */ public static String toHex(byte[] b) { return toHex(b, 0, b.length); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("tableName=").append(tableName); if (families != null) { sb.append(", families=").append(families); } sb.append(", batchSize=").append(batchSize); sb.append(", numHashFiles=").append(numHashFiles); if (!isTableStartRow(startRow)) { sb.append(", startRowHex=").append(Bytes.toHex(startRow)); } if (!isTableEndRow(stopRow)) { sb.append(", stopRowHex=").append(Bytes.toHex(stopRow)); } if (scanBatch >= 0) { sb.append(", scanBatch=").append(scanBatch); } if (versions >= 0) { sb.append(", versions=").append(versions); } if (startTime != 0) { sb.append("startTime=").append(startTime); } if (endTime != 0) { sb.append("endTime=").append(endTime); } return sb.toString(); }
private static String toHex(ImmutableBytesWritable bytes) { return Bytes.toHex(bytes.get(), bytes.getOffset(), bytes.getLength()); }
private static String toHex(ImmutableBytesWritable bytes) { return Bytes.toHex(bytes.get(), bytes.getOffset(), bytes.getLength()); }
private static String toHex(ImmutableBytesWritable bytes) { return Bytes.toHex(bytes.get(), bytes.getOffset(), bytes.getLength()); }
void assertOrder(List<byte[]> bytes, int expectedSize) { String prev = "0"; for (byte[] bytesKey : bytes) { String key = new String(bytesKey); if (StringUtils.isAsciiPrintable(key)) { System.out.println("key = " + key); } else { System.out.println("key = " + Bytes.toHex(bytesKey)); } // System.out.println(prev + ".compareTo(" + key + ") = " + prev.compareTo(key)); assertTrue(prev.compareTo(key) < 0); prev = key; } assertEquals(expectedSize, bytes.size()); }
@Override protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException { String hexBytes = Bytes.toHex(key.get()); Cell[] cells = value.rawCells(); try { if (cells.length < 2) { context.getCounter("opencga", "row.empty").increment(1); return; } context.getCounter("opencga", "variant.read").increment(1); logger.info("Convert ... "); long start = System.nanoTime(); Variant variant = this.getHbaseToVariantConverter().convert(value); if (!requireAnnotation(variant)) { context.getCounter("opencga", "variant.no-annotation-required").increment(1); return; // No annotation needed } logger.info("Add to annotate set {} [convert time: {}] ... ", variant, System.nanoTime() - start); variantsToAnnotate.add(variant); } catch (Exception e) { throw new IllegalStateException("Problems with row [hex:" + hexBytes + "] for cells " + cells.length, e); } }
@Override protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException { boolean done = false; try { Variant variant = this.getHbaseToVariantConverter().convert(value); List<VariantStatsWrapper> annotations = this.variantStatisticsCalculator.calculateBatch( Collections.singletonList(variant), this.studyId, this.samples); for (VariantStatsWrapper annotation : annotations) { Put convert = this.variantStatsToHBaseConverter.convert(annotation); if (null != convert) { context.write(key, convert); done = true; context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "stats.put").increment(1); } } if (done) { context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "variants").increment(1); } } catch (IllegalStateException e) { throw new IllegalStateException("Problem with row [hex:" + Bytes.toHex(key.copyBytes()) + "]", e); } } }