/** {@inheritDoc} */ @Override public EntityId getCurrentKey() throws IOException { return mCurrentRow.getEntityId(); }
/** * Outputs flattened data without schema definitions. * A single line of data contains one key-value record from a fiji family, formatted as: * [entityid]|[timestamp]|[key]|[value] * * @param input The row data to export. * @param context The context to write export to. * @throws IOException if there's an error. */ @Override public void gather(FijiRowData input, GathererContext context) throws IOException { for (String key : input.getQualifiers(mFamily)) { NavigableMap<Long, Object> values = input.getMostRecentValue(mFamily, key); for (Map.Entry<Long, Object> e : values.entrySet()) { // Write this entry out on a single line. mLine.set(makeLine(input.getEntityId(), e.getKey(), key, e.getValue())); context.write(mLine, NullWritable.get()); } } }
/** {@inheritDoc} */ @Override public void produce(FijiRowData input, ProducerContext context) throws IOException { if (!input.containsColumn(getInputColumnName().getFamily(), getInputColumnName().getQualifier())) { LOG.debug("No " + getInputColumnName().getName() + " for entity: " + input.getEntityId()); } String string = input.getMostRecentValue(getInputColumnName().getFamily(), getInputColumnName().getQualifier()).toString(); // Run the regex on the input string. Matcher matcher = mPattern.matcher(string); if (matcher.matches()) { if (matcher.groupCount() == 1) { context.put(matcher.group(1)); } } else { LOG.debug(input.getEntityId().toString() + "'s data '" + string + "' does not match " + mPattern.pattern()); } } }
/** {@inheritDoc} */ @Override protected void map(FijiRowData input, Context mapContext) throws IOException { mProducerContext.setEntityId(input.getEntityId()); mProducer.produce(input, mProducerContext); mapContext.getCounter(JobHistoryCounters.PRODUCER_ROWS_PROCESSED).increment(1); }
/** {@inheritDoc} */ @Override public void produce(FijiRowData input, ProducerContext context) throws IOException { // Extract the affinities for the current input entity (row). Node affinities = getAffinities(input, context); if (null == affinities) { throw new IOException("getAffinities() returned null for entity " + input.getEntityId()); } if (null == affinities.getEdges()) { affinities.setEdges(new ArrayList<Edge>()); } // Get the related items for this entity's affinities. Node relationships = getRelationships(affinities, context); // Compute the recommendations from the entity's affinity relationships. Node recommendations = recommend(relationships, context); // Output the recommendations. if (null != recommendations) { write(recommendations, context); } }
FijiCell<Long> counter = row.getMostRecentCell(family.getName(), key); if (null != counter) { printCell(row.getEntityId(), counter, printStream); FijiCell<Long> counter = row.getMostRecentCell(family.getName(), key); if (null != counter) { printCell(row.getEntityId(), counter, printStream); for (Entry<Long, Object> timestampedCell : keyTimeseriesMap.get(key).entrySet()) { long timestamp = timestampedCell.getKey(); printCell(row.getEntityId(), timestamp, family.getName(), key, timestampedCell.getValue(), printStream); long timestamp = timestampedCell.getKey(); printCell( row.getEntityId(), timestamp, family.getName(), key, timestampedCell.getValue(), printStream); row.getMostRecentCell(colName.getFamily(), colName.getQualifier()); if (null != counter) { printCell(row.getEntityId(), counter, printStream); .entrySet()) { long timestamp = timestampedCell.getKey(); printCell(row.getEntityId(), timestamp, colName.getFamily(), colName.getQualifier(), timestampedCell.getValue(), printStream);
FijiDataRequest fijiDataRequest = DataRequestOptimizer.expandFamilyWithPagedQualifiers(originalDataRequest, qualifiersPage); FijiRowData qualifierPage = mReader.get(mRowData.getEntityId(), fijiDataRequest);
break; if (hasVerboseDebug() && (!row.getEntityId().toShellString().startsWith("hbase="))) { getPrintStream().printf("entity-id=%s%s%n", ToolUtils.HBASE_ROW_KEY_SPEC_PREFIX, Bytes.toStringBinary((row.getEntityId().getHBaseRowKey())));
"FijiRowData must be an instance of HBaseFijiRowData to read TableLayout information."); mEntityId = new EntityIdWritable(rowData.getEntityId()); mWritableData = Maps.newHashMap(); mSchemas = Maps.newHashMap();
FijiRestEntityId.create(rowData.getEntityId(), tableLayout)); Map<String, FamilyLayout> familyLayoutMap = tableLayout.getFamilyMap();
/** {@inheritDoc} */ @Override public void produce(final FijiRowData row, final FijiTableContext context) throws IOException { final Iterable<FijiCell<Object>> cells; if (mColumn.isFullyQualified()) { cells = row.asIterable(mColumn.getFamily(), mColumn.getQualifier()); } else { cells = row.asIterable(mColumn.getFamily()); } for (FijiCell<Object> cell : cells) { context.incrementCounter(Counters.CELLS_PROCESSED); final DecodedCell<Object> original = new DecodedCell<Object>(cell.getWriterSchema(), cell.getData()); final DecodedCell<Object> rewritten = rewriteCell(original); if (rewritten != original) { context.put( row.getEntityId(), mColumn.getFamily(), mColumn.getQualifier(), cell.getTimestamp(), rewritten.getData()); context.incrementCounter(Counters.CELLS_REWRITTEN); } } }