Skip to content

Sai prefixv2#4909

Draft
pranavshenoy wants to merge 3 commits into
apache:trunkfrom
pranavshenoy:sai_prefixv2
Draft

Sai prefixv2#4909
pranavshenoy wants to merge 3 commits into
apache:trunkfrom
pranavshenoy:sai_prefixv2

Conversation

@pranavshenoy

Copy link
Copy Markdown
Contributor

Thanks for sending a pull request! Here are some tips if you're new here:

  • Ensure you have added or run the appropriate tests for your PR.
  • Be sure to keep the PR description updated to reflect all changes.
  • Write your PR title to summarize what this PR proposes.
  • If possible, provide a concise example to reproduce the issue for a faster review.
  • Read our contributor guidelines
  • If you're making a documentation change, see our guide to documentation contribution

Commit messages should follow the following format:

<One sentence description, usually Jira title or CHANGES.txt summary>

<Optional lengthier description (context on patch)>

patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####

Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>

The Cassandra Jira

* Depth is 1-based on the key bytes (the first byte is depth 1); the empty prefix (depth 0, the root) is never
* accumulated. A null policy is equivalent to {@link #putSingleton(ByteComparable, Object, UpsertTransformer, boolean)}.
*/
public <R> void putSingleton(ByteComparable key,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: avoid code duplication. probably we could pass a new arg to putSingleton() and/or putRecursive.

We might need to support both the flows as well.

totalPostings++;
}

if (count > 0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it writes to the disk, we are technically doing two different IOs (one for exact and other for Prefix), this can be avoided

}

this.blockSize = input.readVInt();
//TODO This should need to change because we can potentially end up with postings of more than Integer.MAX_VALUE?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we change it to long since we will have more postings with prefix?

{
ByteBuffer prefixValue = expression.lower().value.encoded;
ByteComparable start = v -> index.termType().asComparableBytes(prefixValue, v);
ByteBuffer successor = prefixSuccessor(prefixValue);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

successor is used to pass it to the in-memory subtrie() API. do we actually need the successor here?

if (indexTermType.isLiteral() && literalPrefixEnabled)
{
int skip = CassandraRelevantProperties.SAI_POSTINGS_SKIP.getInt();
SegmentTrieBuffer buffer = new SegmentTrieBuffer(depth -> depth % skip == 0);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: avoid using segmentriebuffer instead try to do it in place for memtableIndexwriter

{
ByteBuffer prefixBuffer = expression.lower().value.encoded;
ByteComparable lowerBound = asComparableBytes(prefixBuffer);
ByteBuffer successor = prefixSuccessor(prefixBuffer);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisit if we really need prefixSuccessor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant