Tabnine Logo
Rows.merge
Code IndexAdd Tabnine to your IDE (free)

How to use
merge
method
in
org.apache.cassandra.db.rows.Rows

Best Java code snippets using org.apache.cassandra.db.rows.Rows.merge (Showing top 20 results out of 315)

origin: org.apache.cassandra/cassandra-all

private BTree.Builder<Row> builder(int initialCapacity)
{
  return BTree.<Row>builder(metadata.comparator, initialCapacity)
        .setQuickResolver((a, b) ->
                 Rows.merge(a, b, createdAtInSec));
}
origin: jsevellec/cassandra-unit

private BTree.Builder<Row> builder(int initialCapacity)
{
  return BTree.<Row>builder(metadata.comparator, initialCapacity)
        .setQuickResolver((a, b) ->
                 Rows.merge(a, b, createdAtInSec));
}
origin: jsevellec/cassandra-unit

public static Row merge(Row row1, Row row2, int nowInSec)
{
  Row.Builder builder = BTreeRow.sortedBuilder();
  merge(row1, row2, builder, nowInSec);
  return builder.build();
}
origin: org.apache.cassandra/cassandra-all

public static Row merge(Row row1, Row row2, int nowInSec)
{
  Row.Builder builder = BTreeRow.sortedBuilder();
  merge(row1, row2, builder, nowInSec);
  return builder.build();
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

private BTree.Builder<Row> builder(int initialCapacity)
{
  return BTree.<Row>builder(metadata.comparator, initialCapacity)
        .setQuickResolver((a, b) ->
                 Rows.merge(a, b, createdAtInSec));
}
origin: com.strapdata.cassandra/cassandra-all

private BTree.Builder<Row> builder(int initialCapacity)
{
  return BTree.<Row>builder(metadata.comparator, initialCapacity)
        .setQuickResolver((a, b) ->
                 Rows.merge(a, b, createdAtInSec));
}
origin: com.strapdata.cassandra/cassandra-all

public static Row merge(Row row1, Row row2, int nowInSec)
{
  Row.Builder builder = BTreeRow.sortedBuilder();
  merge(row1, row2, builder, nowInSec);
  return builder.build();
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static Row merge(Row row1, Row row2, int nowInSec)
{
  Row.Builder builder = BTreeRow.sortedBuilder();
  merge(row1, row2, builder, nowInSec);
  return builder.build();
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * Given an existing base row and the update that we're going to apply to this row, generate the modifications
 * to apply to MVs using the provided {@code ViewUpdateGenerator}s.
 *
 * @param existingBaseRow the base table row as it is before an update.
 * @param updateBaseRow the newly updates made to {@code existingBaseRow}.
 * @param generators the view update generators to add the new changes to.
 * @param nowInSec the current time in seconds. Used to decide if data is live or not.
 */
private static void addToViewUpdateGenerators(Row existingBaseRow, Row updateBaseRow, Collection<ViewUpdateGenerator> generators, int nowInSec)
{
  // Having existing empty is useful, it just means we'll insert a brand new entry for updateBaseRow,
  // but if we have no update at all, we shouldn't get there.
  assert !updateBaseRow.isEmpty();
  // We allow existingBaseRow to be null, which we treat the same as being empty as an small optimization
  // to avoid allocating empty row objects when we know there was nothing existing.
  Row mergedBaseRow = existingBaseRow == null ? updateBaseRow : Rows.merge(existingBaseRow, updateBaseRow, nowInSec);
  for (ViewUpdateGenerator generator : generators)
    generator.addBaseTableUpdate(existingBaseRow, mergedBaseRow);
}
origin: org.apache.cassandra/cassandra-all

/**
 * Given an existing base row and the update that we're going to apply to this row, generate the modifications
 * to apply to MVs using the provided {@code ViewUpdateGenerator}s.
 *
 * @param existingBaseRow the base table row as it is before an update.
 * @param updateBaseRow the newly updates made to {@code existingBaseRow}.
 * @param generators the view update generators to add the new changes to.
 * @param nowInSec the current time in seconds. Used to decide if data is live or not.
 */
private static void addToViewUpdateGenerators(Row existingBaseRow, Row updateBaseRow, Collection<ViewUpdateGenerator> generators, int nowInSec)
{
  // Having existing empty is useful, it just means we'll insert a brand new entry for updateBaseRow,
  // but if we have no update at all, we shouldn't get there.
  assert !updateBaseRow.isEmpty();
  // We allow existingBaseRow to be null, which we treat the same as being empty as an small optimization
  // to avoid allocating empty row objects when we know there was nothing existing.
  Row mergedBaseRow = existingBaseRow == null ? updateBaseRow : Rows.merge(existingBaseRow, updateBaseRow, nowInSec);
  for (ViewUpdateGenerator generator : generators)
    generator.addBaseTableUpdate(existingBaseRow, mergedBaseRow);
}
origin: jsevellec/cassandra-unit

/**
 * Given an existing base row and the update that we're going to apply to this row, generate the modifications
 * to apply to MVs using the provided {@code ViewUpdateGenerator}s.
 *
 * @param existingBaseRow the base table row as it is before an update.
 * @param updateBaseRow the newly updates made to {@code existingBaseRow}.
 * @param generators the view update generators to add the new changes to.
 * @param nowInSec the current time in seconds. Used to decide if data is live or not.
 */
private static void addToViewUpdateGenerators(Row existingBaseRow, Row updateBaseRow, Collection<ViewUpdateGenerator> generators, int nowInSec)
{
  // Having existing empty is useful, it just means we'll insert a brand new entry for updateBaseRow,
  // but if we have no update at all, we shouldn't get there.
  assert !updateBaseRow.isEmpty();
  // We allow existingBaseRow to be null, which we treat the same as being empty as an small optimization
  // to avoid allocating empty row objects when we know there was nothing existing.
  Row mergedBaseRow = existingBaseRow == null ? updateBaseRow : Rows.merge(existingBaseRow, updateBaseRow, nowInSec);
  for (ViewUpdateGenerator generator : generators)
    generator.addBaseTableUpdate(existingBaseRow, mergedBaseRow);
}
origin: jsevellec/cassandra-unit

public Row apply(Row existing, Row update)
{
  Row.Builder builder = builder(existing.clustering());
  colUpdateTimeDelta = Math.min(colUpdateTimeDelta, Rows.merge(existing, update, builder, nowInSec));
  Row reconciled = builder.build();
  indexer.onUpdated(existing, reconciled);
  dataSize += reconciled.dataSize() - existing.dataSize();
  heapSize += reconciled.unsharedHeapSizeExcludingData() - existing.unsharedHeapSizeExcludingData();
  if (inserted == null)
    inserted = new ArrayList<>();
  inserted.add(reconciled);
  return reconciled;
}
origin: org.apache.cassandra/cassandra-all

public Row apply(Row existing, Row update)
{
  Row.Builder builder = builder(existing.clustering());
  colUpdateTimeDelta = Math.min(colUpdateTimeDelta, Rows.merge(existing, update, builder, nowInSec));
  Row reconciled = builder.build();
  indexer.onUpdated(existing, reconciled);
  dataSize += reconciled.dataSize() - existing.dataSize();
  heapSize += reconciled.unsharedHeapSizeExcludingData() - existing.unsharedHeapSizeExcludingData();
  if (inserted == null)
    inserted = new ArrayList<>();
  inserted.add(reconciled);
  return reconciled;
}
origin: com.strapdata.cassandra/cassandra-all

public Row apply(Row existing, Row update)
{
  Row.Builder builder = builder(existing.clustering());
  colUpdateTimeDelta = Math.min(colUpdateTimeDelta, Rows.merge(existing, update, builder, nowInSec));
  Row reconciled = builder.build();
  indexer.onUpdated(existing, reconciled);
  dataSize += reconciled.dataSize() - existing.dataSize();
  heapSize += reconciled.unsharedHeapSizeExcludingData() - existing.unsharedHeapSizeExcludingData();
  if (inserted == null)
    inserted = new ArrayList<>();
  inserted.add(reconciled);
  return reconciled;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public Row apply(Row existing, Row update)
{
  Row.Builder builder = builder(existing.clustering());
  colUpdateTimeDelta = Math.min(colUpdateTimeDelta, Rows.merge(existing, update, builder, nowInSec));
  Row reconciled = builder.build();
  indexer.onUpdated(existing, reconciled);
  dataSize += reconciled.dataSize() - existing.dataSize();
  heapSize += reconciled.unsharedHeapSizeExcludingData() - existing.unsharedHeapSizeExcludingData();
  if (inserted == null)
    inserted = new ArrayList<>();
  inserted.add(reconciled);
  return reconciled;
}
origin: org.apache.cassandra/cassandra-all

private synchronized void build()
{
  if (isBuilt)
    return;
  Holder holder = this.holder;
  Object[] cur = holder.tree;
  Object[] add = rowBuilder.build();
  Object[] merged = BTree.<Row>merge(cur, add, metadata.comparator,
                    UpdateFunction.Simple.of((a, b) -> Rows.merge(a, b, createdAtInSec)));
  assert deletionInfo == holder.deletionInfo;
  EncodingStats newStats = EncodingStats.Collector.collect(holder.staticRow, BTree.<Row>iterator(merged), deletionInfo);
  this.holder = new Holder(holder.columns, merged, holder.deletionInfo, holder.staticRow, newStats);
  rowBuilder = null;
  isBuilt = true;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

private synchronized void build()
{
  if (isBuilt)
    return;
  Holder holder = this.holder;
  Object[] cur = holder.tree;
  Object[] add = rowBuilder.build();
  Object[] merged = BTree.<Row>merge(cur, add, metadata.comparator,
                    UpdateFunction.Simple.of((a, b) -> Rows.merge(a, b, createdAtInSec)));
  assert deletionInfo == holder.deletionInfo;
  EncodingStats newStats = EncodingStats.Collector.collect(holder.staticRow, BTree.<Row>iterator(merged), deletionInfo);
  this.holder = new Holder(holder.columns, merged, holder.deletionInfo, holder.staticRow, newStats);
  rowBuilder = null;
  isBuilt = true;
}
origin: jsevellec/cassandra-unit

private synchronized void build()
{
  if (isBuilt)
    return;
  Holder holder = this.holder;
  Object[] cur = holder.tree;
  Object[] add = rowBuilder.build();
  Object[] merged = BTree.<Row>merge(cur, add, metadata.comparator,
                    UpdateFunction.Simple.of((a, b) -> Rows.merge(a, b, createdAtInSec)));
  assert deletionInfo == holder.deletionInfo;
  EncodingStats newStats = EncodingStats.Collector.collect(holder.staticRow, BTree.<Row>iterator(merged), deletionInfo);
  this.holder = new Holder(holder.columns, merged, holder.deletionInfo, holder.staticRow, newStats);
  rowBuilder = null;
  isBuilt = true;
}
origin: com.strapdata.cassandra/cassandra-all

private synchronized void build()
{
  if (isBuilt)
    return;
  Holder holder = this.holder;
  Object[] cur = holder.tree;
  Object[] add = rowBuilder.build();
  Object[] merged = BTree.<Row>merge(cur, add, metadata.comparator,
                    UpdateFunction.Simple.of((a, b) -> Rows.merge(a, b, createdAtInSec)));
  assert deletionInfo == holder.deletionInfo;
  EncodingStats newStats = EncodingStats.Collector.collect(holder.staticRow, BTree.<Row>iterator(merged), deletionInfo);
  this.holder = new Holder(holder.columns, merged, holder.deletionInfo, holder.staticRow, newStats);
  rowBuilder = null;
  isBuilt = true;
}
origin: jsevellec/cassandra-unit

  @Override
  public Unfiltered next()
  {
    Unfiltered next = nextToOffer != null ? nextToOffer : wrapped.next();
    if (next.isRow())
    {
      while (wrapped.hasNext())
      {
        Unfiltered peek = wrapped.next();
        if (!peek.isRow() || !next.clustering().equals(peek.clustering()))
        {
          nextToOffer = peek; // Offer peek in next call
          return next;
        }
        // Duplicate row, merge it.
        next = Rows.merge((Row) next, (Row) peek, FBUtilities.nowInSeconds());
      }
    }
    nextToOffer = null;
    return next;
  }
}
org.apache.cassandra.db.rowsRowsmerge

Javadoc

Merges two rows into the given builder, mainly for merging memtable rows. In addition to reconciling the cells in each row, the liveness info, and deletion times for the row and complex columns are also merged.

Note that this method assumes that the provided rows can meaningfully be reconciled together. That is, that the rows share the same clustering value, and belong to the same partition.

Popular methods of Rows

  • collectStats
    Collect statistics on a given row.
  • copy
  • diff
    Given the result ( merged) of merging multiple inputs, signals the difference between each input and
  • getColumnDefinition
    Returns the ColumnDefinition to use for merging the columns. If the 2 column definitions are differe
  • removeShadowedCells
    Returns a row that is obtained from the given existing row by removing everything that is shadowed b
  • simpleBuilder
    Creates a new simple row builder.

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now