/** * Prints the data for a single entity id. * * @param reader The reader. * @param request The data request. * @param entityId The entity id to lookup. * @param mapTypeFamilies The map type families to print. * @param groupTypeColumns The group type columns to print. * @return A program exit code (zero on success). */ private int lookup( FijiTableReader reader, FijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { try { final FijiRowData row = reader.get(entityId, request); if (hasVerboseDebug() && (!ToolUtils.formatEntityId(entityId).startsWith("hbase="))) { getPrintStream().printf("entity-id=%s%s%n", ToolUtils.HBASE_ROW_KEY_SPEC_PREFIX, Bytes.toStringBinary((entityId.getHBaseRowKey()))); } ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return FAILURE; } return SUCCESS; }
final byte[] hbaseRowKey = parseBytesFlag(hbaseSpec); return factory.getEntityIdFromHBaseRowKey(hbaseRowKey); : entityFlag; return parseFijiRowKey(fijiSpec, factory, layout);
/** * Parses a Fiji row key specification from a command-line flag. * * @param rowKeySpec Fiji row key specification. * @param factory Factory for entity IDs. * @param layout Layout of the table to parse the entity ID of. * @return the parsed entity ID. * @throws IOException on I/O error. */ public static EntityId parseFijiRowKey( String rowKeySpec, EntityIdFactory factory, FijiTableLayout layout) throws IOException { final Object keysFormat = layout.getDesc().getKeysFormat(); if (keysFormat instanceof RowKeyFormat) { // Former, deprecated, unformatted row key specification: return factory.getEntityId(rowKeySpec); } else if (keysFormat instanceof RowKeyFormat2) { final RowKeyFormat2 format = (RowKeyFormat2) keysFormat; switch (format.getEncoding()) { case RAW: return factory.getEntityIdFromHBaseRowKey(parseBytesFlag(rowKeySpec)); case FORMATTED: return parseJsonFormattedKeySpec(rowKeySpec, format, factory); default: throw new RuntimeException(String.format( "Invalid layout for table '%s' with unsupported keys format: '%s'.", layout.getName(), format)); } } else { throw new RuntimeException(String.format("Unknown row key format: '%s'.", keysFormat)); } }
ToolUtils.getMapTypeFamilies(argURI.getColumns(), tableLayout); ToolUtils.getGroupTypeColumns(argURI.getColumns(), tableLayout); final FijiDataRequest request = ToolUtils.getDataRequest( mapTypeFamilies, groupTypeColumns, mMaxVersions, mMinTimestamp, mMaxTimestamp); ToolUtils.createEntityIdFromUserInputs(mEntityIdFlag, tableLayout); "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from fiji table: " + argURI); return lookup(reader, request, entityId, mapTypeFamilies, groupTypeColumns);
EntityId entityId = ToolUtils.createEntityIdFromUserInputs( fijiRowDataWritable.getEntityId().toShellString(), fijiTableLayout);
/** * Prints the contents of a single fiji cell to the printstream. * * @param entityId The entity id. * @param timestamp This timestamp of a FijiCell. * @param family The family of a FijiCell. * @param qualifier The qualifier of a FijiCell. * @param cellData The contents of a FijiCell. * @param printStream The stream to print to. */ private static void printCell(EntityId entityId, Long timestamp, String family, String qualifier, Object cellData, PrintStream printStream) { printStream.printf("entity-id=%s [%d] %s:%s%n %s%n", formatEntityId(entityId), timestamp, family, qualifier, cellData); }
addColumn(family, rawColumn.getQualifier(), familyMap);
final Object[] components = new Object[node.size()]; for (int i = 0; i < node.size(); ++i) { components[i] = getJsonStringOrIntValue(node.get(i)); return factory.getEntityId(getJsonStringOrIntValue(node));
ToolUtils.getMapTypeFamilies(argURI.getColumns(), tableLayout); ToolUtils.getGroupTypeColumns(argURI.getColumns(), tableLayout); final FijiDataRequest request = ToolUtils.getDataRequest( mapTypeFamilies, groupTypeColumns, mMaxVersions, mMinTimestamp, mMaxTimestamp); ? ToolUtils.createEntityIdFromUserInputs(mStartRowFlag, tableLayout) : null; final EntityId limitRow = (mLimitRowFlag != null) ? ToolUtils.createEntityIdFromUserInputs(mLimitRowFlag, tableLayout) : null; getPrintStream().println("Scanning fiji table: " + argURI);
ToolUtils.createEntityIdFromUserInputs(mEntityId, layout);
/** * Prints the contents of a single fiji cell to the printstream. * * @param entityId The entity id. * @param cell The FijiCell. * @param printStream The stream to print to. */ private static void printCell(EntityId entityId, FijiCell<?> cell, PrintStream printStream) { printStream.printf("entity-id=%s [%d] %s:%s%n %s%n", formatEntityId(entityId), cell.getTimestamp(), cell.getColumn().getFamily(), cell.getColumn().getQualifier(), cell.getData()); }
try { final EntityId entityId = ToolUtils.createEntityIdFromUserInputs(mEntityIdFlag, table.getLayout()); return deleteFromRow(table, entityId, columns, mTimestampMode, mTimestamp); } finally {
/** {@inheritDoc} */ @Override protected void configure(B jobBuilder) throws ClassNotFoundException, IOException { // Basic job configuration (base JobConf, jars and KV stores): super.configure(jobBuilder); // Configure job input: jobBuilder.withJobInput(mJobInput); final Fiji fiji = Fiji.Factory.open(mJobInput.getInputTableURI(), getConf()); try { final FijiTable table = fiji.openTable(mJobInput.getInputTableURI().getTable()); try { if (mStartRowFlag != null) { final EntityId eidLimit = ToolUtils.createEntityIdFromUserInputs(mStartRowFlag, table.getLayout()); jobBuilder.withStartRow(eidLimit); } if (mLimitRowFlag != null) { final EntityId eidLimit = ToolUtils.createEntityIdFromUserInputs(mLimitRowFlag, table.getLayout()); jobBuilder.withLimitRow(eidLimit); } } finally { ResourceUtils.releaseOrLog(table); } } finally { ResourceUtils.releaseOrLog(fiji); } }
ToolUtils.createEntityIdFromUserInputs(mEntityId, table.getLayout()); writer.increment(entityId, column.getFamily(), column.getQualifier(), mValue);