Search in sources :

Example 1 with Pair

use of com.google.code.or.common.glossary.Pair in project databus by linkedin.

the class ORListener method updateRows.

private void updateRows(UpdateRowsEvent ure) {
    if (_ignoreSource) {
        LOG.info("Ignoring update rows for " + _curSourceName);
        return;
    }
    List<Pair<Row>> lp = ure.getRows();
    List<Row> lr = new ArrayList<Row>(lp.size());
    for (Pair<Row> pr : lp) {
        Row r = pr.getAfter();
        lr.add(r);
    }
    if (lr.size() > 0) {
        LOG.info("UPDATE " + _curSourceName + ": " + lr.size());
        frameAvroRecord(ure.getTableId(), ure.getHeader(), lr, DbusOpcode.UPSERT);
    }
}
Also used : ArrayList(java.util.ArrayList) Row(com.google.code.or.common.glossary.Row) KeyPair(com.linkedin.databus2.producers.ds.KeyPair) Pair(com.google.code.or.common.glossary.Pair)

Example 2 with Pair

use of com.google.code.or.common.glossary.Pair in project databus by linkedin.

the class ORListener method updateRows.

private void updateRows(UpdateRowsEventV2 ure) {
    if (_ignoreSource) {
        LOG.info("Ignoring update rows for " + _curSourceName);
        return;
    }
    List<Pair<Row>> lp = ure.getRows();
    List<Row> lr = new ArrayList<Row>(lp.size());
    for (Pair<Row> pr : lp) {
        Row r = pr.getAfter();
        lr.add(r);
    }
    if (lr.size() > 0) {
        LOG.info("UPDATE " + _curSourceName + ": " + lr.size());
        frameAvroRecord(ure.getTableId(), ure.getHeader(), lr, DbusOpcode.UPSERT);
    }
}
Also used : ArrayList(java.util.ArrayList) Row(com.google.code.or.common.glossary.Row) KeyPair(com.linkedin.databus2.producers.ds.KeyPair) Pair(com.google.code.or.common.glossary.Pair)

Aggregations

Pair (com.google.code.or.common.glossary.Pair)2 Row (com.google.code.or.common.glossary.Row)2 KeyPair (com.linkedin.databus2.producers.ds.KeyPair)2 ArrayList (java.util.ArrayList)2