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

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

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

origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

/**
 * Merges the provided updates, yielding a new update that incorporates all those updates.
 *
 * @param updates the collection of updates to merge. This shouldn't be empty.
 *
 * @return a partition update that include (merge) all the updates from {@code updates}.
 */
public static PartitionUpdate merge(List<PartitionUpdate> updates)
{
  assert !updates.isEmpty();
  final int size = updates.size();
  if (size == 1)
    return Iterables.getOnlyElement(updates);
  int nowInSecs = FBUtilities.nowInSeconds();
  List<UnfilteredRowIterator> asIterators = Lists.transform(updates, AbstractBTreePartition::unfilteredIterator);
  return fromIterator(UnfilteredRowIterators.merge(asIterators, nowInSecs), ColumnFilter.all(updates.get(0).metadata()));
}
origin: org.apache.cassandra/cassandra-all

/**
 * Merges the provided updates, yielding a new update that incorporates all those updates.
 *
 * @param updates the collection of updates to merge. This shouldn't be empty.
 *
 * @return a partition update that include (merge) all the updates from {@code updates}.
 */
public static PartitionUpdate merge(List<PartitionUpdate> updates)
{
  assert !updates.isEmpty();
  final int size = updates.size();
  if (size == 1)
    return Iterables.getOnlyElement(updates);
  int nowInSecs = FBUtilities.nowInSeconds();
  List<UnfilteredRowIterator> asIterators = Lists.transform(updates, AbstractBTreePartition::unfilteredIterator);
  return fromIterator(UnfilteredRowIterators.merge(asIterators, nowInSecs), ColumnFilter.all(updates.get(0).metadata()));
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * Merges the provided updates, yielding a new update that incorporates all those updates.
 *
 * @param updates the collection of updates to merge. This shouldn't be empty.
 *
 * @return a partition update that include (merge) all the updates from {@code updates}.
 */
public static PartitionUpdate merge(List<PartitionUpdate> updates)
{
  assert !updates.isEmpty();
  final int size = updates.size();
  if (size == 1)
    return Iterables.getOnlyElement(updates);
  int nowInSecs = FBUtilities.nowInSeconds();
  List<UnfilteredRowIterator> asIterators = Lists.transform(updates, AbstractBTreePartition::unfilteredIterator);
  return fromIterator(UnfilteredRowIterators.merge(asIterators, nowInSecs), ColumnFilter.all(updates.get(0).metadata()));
}
origin: jsevellec/cassandra-unit

private ImmutableBTreePartition add(UnfilteredRowIterator iter, ImmutableBTreePartition result, ClusteringIndexNamesFilter filter, boolean isRepaired)
{
  if (!isRepaired)
    oldestUnrepairedTombstone = Math.min(oldestUnrepairedTombstone, iter.stats().minLocalDeletionTime);
  int maxRows = Math.max(filter.requestedRows().size(), 1);
  if (result == null)
    return ImmutableBTreePartition.create(iter, maxRows);
  try (UnfilteredRowIterator merged = UnfilteredRowIterators.merge(Arrays.asList(iter, result.unfilteredIterator(columnFilter(), Slices.ALL, filter.isReversed())), nowInSec()))
  {
    return ImmutableBTreePartition.create(merged, maxRows);
  }
}
origin: org.apache.cassandra/cassandra-all

private ImmutableBTreePartition add(UnfilteredRowIterator iter, ImmutableBTreePartition result, ClusteringIndexNamesFilter filter, boolean isRepaired)
{
  if (!isRepaired)
    oldestUnrepairedTombstone = Math.min(oldestUnrepairedTombstone, iter.stats().minLocalDeletionTime);
  int maxRows = Math.max(filter.requestedRows().size(), 1);
  if (result == null)
    return ImmutableBTreePartition.create(iter, maxRows);
  try (UnfilteredRowIterator merged = UnfilteredRowIterators.merge(Arrays.asList(iter, result.unfilteredIterator(columnFilter(), Slices.ALL, filter.isReversed())), nowInSec()))
  {
    return ImmutableBTreePartition.create(merged, maxRows);
  }
}
origin: jsevellec/cassandra-unit

  @Override
  protected UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
  {
    Iterable<UnfilteredRowIterator> sources = controller.shadowSources(partition.partitionKey(), !cellLevelGC);
    if (sources == null)
      return partition;
    List<UnfilteredRowIterator> iters = new ArrayList<>();
    for (UnfilteredRowIterator iter : sources)
    {
      if (!iter.isEmpty())
        iters.add(iter);
      else
        iter.close();
    }
    if (iters.isEmpty())
      return partition;
    return new GarbageSkippingUnfilteredRowIterator(partition, UnfilteredRowIterators.merge(iters, nowInSec), nowInSec, cellLevelGC);
  }
}
origin: org.apache.cassandra/cassandra-all

  @Override
  protected UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
  {
    Iterable<UnfilteredRowIterator> sources = controller.shadowSources(partition.partitionKey(), !cellLevelGC);
    if (sources == null)
      return partition;
    List<UnfilteredRowIterator> iters = new ArrayList<>();
    for (UnfilteredRowIterator iter : sources)
    {
      if (!iter.isEmpty())
        iters.add(iter);
      else
        iter.close();
    }
    if (iters.isEmpty())
      return partition;
    return new GarbageSkippingUnfilteredRowIterator(partition, UnfilteredRowIterators.merge(iters, nowInSec), nowInSec, cellLevelGC);
  }
}
origin: com.strapdata.cassandra/cassandra-all

  @Override
  protected UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
  {
    Iterable<UnfilteredRowIterator> sources = controller.shadowSources(partition.partitionKey(), !cellLevelGC);
    if (sources == null)
      return partition;
    List<UnfilteredRowIterator> iters = new ArrayList<>();
    for (UnfilteredRowIterator iter : sources)
    {
      if (!iter.isEmpty())
        iters.add(iter);
      else
        iter.close();
    }
    if (iters.isEmpty())
      return partition;
    return new GarbageSkippingUnfilteredRowIterator(partition, UnfilteredRowIterators.merge(iters, nowInSec), nowInSec, cellLevelGC);
  }
}
origin: com.strapdata.cassandra/cassandra-all

private ImmutableBTreePartition add(UnfilteredRowIterator iter, ImmutableBTreePartition result, ClusteringIndexNamesFilter filter, boolean isRepaired)
{
  if (!isRepaired)
    oldestUnrepairedTombstone = Math.min(oldestUnrepairedTombstone, iter.stats().minLocalDeletionTime);
  int maxRows = Math.max(filter.requestedRows().size(), 1);
  if (result == null)
    return ImmutableBTreePartition.create(iter, maxRows);
  try (UnfilteredRowIterator merged = UnfilteredRowIterators.merge(Arrays.asList(iter, result.unfilteredIterator(columnFilter(), Slices.ALL, filter.isReversed())), nowInSec()))
  {
    return ImmutableBTreePartition.create(merged, maxRows);
  }
}
origin: jsevellec/cassandra-unit

/**
 * Merges the provided updates, yielding a new update that incorporates all those updates.
 *
 * @param updates the collection of updates to merge. This shouldn't be empty.
 *
 * @return a partition update that include (merge) all the updates from {@code updates}.
 */
public static PartitionUpdate merge(List<PartitionUpdate> updates)
{
  assert !updates.isEmpty();
  final int size = updates.size();
  if (size == 1)
    return Iterables.getOnlyElement(updates);
  int nowInSecs = FBUtilities.nowInSeconds();
  List<UnfilteredRowIterator> asIterators = Lists.transform(updates, AbstractBTreePartition::unfilteredIterator);
  return fromIterator(UnfilteredRowIterators.merge(asIterators, nowInSecs), ColumnFilter.all(updates.get(0).metadata()));
}
origin: jsevellec/cassandra-unit

/**
 * Return a wrapped iterator that when closed will update the sstables iterated and READ sample metrics.
 * Note that we cannot use the Transformations framework because they greedily get the static row, which
 * would cause all iterators to be initialized and hence all sstables to be accessed.
 */
private UnfilteredRowIterator withSSTablesIterated(List<UnfilteredRowIterator> iterators,
                          TableMetrics metrics,
                          SSTableReadMetricsCollector metricsCollector)
{
  @SuppressWarnings("resource") //  Closed through the closing of the result of the caller method.
  UnfilteredRowIterator merged = UnfilteredRowIterators.merge(iterators, nowInSec());
  if (!merged.isEmpty())
  {
    DecoratedKey key = merged.partitionKey();
    metrics.samplers.get(TableMetrics.Sampler.READS).addSample(key.getKey(), key.hashCode(), 1);
  }
  class UpdateSstablesIterated extends Transformation
  {
    public void onPartitionClose()
    {
      int mergedSSTablesIterated = metricsCollector.getMergedSSTables();
      metrics.updateSSTableIterated(mergedSSTablesIterated);
      Tracing.trace("Merged data from memtables and {} sstables", mergedSSTablesIterated);
    }
  };
  return Transformation.apply(merged, new UpdateSstablesIterated());
}
origin: org.apache.cassandra/cassandra-all

/**
 * Return a wrapped iterator that when closed will update the sstables iterated and READ sample metrics.
 * Note that we cannot use the Transformations framework because they greedily get the static row, which
 * would cause all iterators to be initialized and hence all sstables to be accessed.
 */
private UnfilteredRowIterator withSSTablesIterated(List<UnfilteredRowIterator> iterators,
                          TableMetrics metrics,
                          SSTableReadMetricsCollector metricsCollector)
{
  @SuppressWarnings("resource") //  Closed through the closing of the result of the caller method.
  UnfilteredRowIterator merged = UnfilteredRowIterators.merge(iterators, nowInSec());
  if (!merged.isEmpty())
  {
    DecoratedKey key = merged.partitionKey();
    metrics.samplers.get(TableMetrics.Sampler.READS).addSample(key.getKey(), key.hashCode(), 1);
  }
  class UpdateSstablesIterated extends Transformation
  {
    public void onPartitionClose()
    {
      int mergedSSTablesIterated = metricsCollector.getMergedSSTables();
      metrics.updateSSTableIterated(mergedSSTablesIterated);
      Tracing.trace("Merged data from memtables and {} sstables", mergedSSTablesIterated);
    }
  };
  return Transformation.apply(merged, new UpdateSstablesIterated());
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * Return a wrapped iterator that when closed will update the sstables iterated and READ sample metrics.
 * Note that we cannot use the Transformations framework because they greedily get the static row, which
 * would cause all iterators to be initialized and hence all sstables to be accessed.
 */
private UnfilteredRowIterator withSSTablesIterated(List<UnfilteredRowIterator> iterators,
                          TableMetrics metrics,
                          SSTableReadMetricsCollector metricsCollector)
{
  @SuppressWarnings("resource") //  Closed through the closing of the result of the caller method.
  UnfilteredRowIterator merged = UnfilteredRowIterators.merge(iterators, nowInSec());
  if (!merged.isEmpty())
  {
    DecoratedKey key = merged.partitionKey();
    metrics.samplers.get(TableMetrics.Sampler.READS).addSample(key.getKey(), key.hashCode(), 1);
  }
  class UpdateSstablesIterated extends Transformation
  {
    public void onPartitionClose()
    {
      int mergedSSTablesIterated = metricsCollector.getMergedSSTables();
      metrics.updateSSTableIterated(mergedSSTablesIterated);
      Tracing.trace("Merged data from memtables and {} sstables", mergedSSTablesIterated);
    }
  };
  return Transformation.apply(merged, new UpdateSstablesIterated());
}
org.apache.cassandra.db.rowsUnfilteredRowIteratorsmerge

Javadoc

Returns an iterator that is the result of merging other iterators.

Popular methods of UnfilteredRowIterators

  • filter
    Returns a iterator that only returns rows with only live content. This is mainly used in the CQL lay
  • noRowsIterator
    Returns an empty unfiltered iterator for a given partition.
  • withOnlyQueriedData
    Filter the provided iterator to exclude cells that have been fetched but are not queried by the user
  • concat
    Returns an iterator that concatenate two atom iterators. This method assumes that both iterator are
  • digest
    Digests the partition represented by the provided iterator.
  • withValidation
    Validate that the data of the provided iterator is valid, that is that the values it contains are va
  • singleton

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Join (org.hibernate.mapping)
  • From CI to AI: The AI layer in your organization
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