[
https://issues.apache.org/jira/browse/CASSANDRA-18590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732143#comment-17732143
]
Caleb Rackliffe commented on CASSANDRA-18590:
---------------------------------------------
bq. I like that idea, and I think we can do it here/now without much trouble.
I'd call it IndexableType (or TermType as you've suggested), and it could store
the base type (accounting for ReversedType) and the fixed size (so we don't
calculate it at all on the hot path), with the other methods moved, as you've
mentioned. Shove it in the IndexContext and we should have access to it almost
everywhere.
bq. We'd want to store the original (possibly reversed) type too, of course for
operations that want that rather than the base type. For creation, I'd go w/ a
static factory in IndexableType like of().
> Introduce IndexTermType to replace TypeUtils in SAI
> ---------------------------------------------------
>
> Key: CASSANDRA-18590
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18590
> Project: Cassandra
> Issue Type: Improvement
> Components: Feature/SAI
> Reporter: Mike Adamson
> Priority: Normal
>
> From a review comment by [~adelapena] on the
> [CASSANDRA-18067|https://issues.apache.org/jira/browse/CASSANDRA-18067] PR
> {quote}Not directly related to this ticket, but it seems to me that the
> methods on TypeUtil do a lot of repeated work in the hot path just to
> determine the data type of the caller. These operations include finding the
> base type of reversed multiple times, multiple instanceof calls, etc. All
> these operations on each index are called with the same
> IndexContext#getValidator argument, needlessly repeating work for every
> column value.
> I understand that most of the methods on TypeUtil are things that would
> normally be part of AbstractType, so each particular data type can provide
> its own implementation. But we don't want to couple the generic data types
> with SAI, so we have this class instead.
> I think that we could add a kind of TermType class decorating AbstractType,
> and subclass it for every data type that gets special treatment (LONG,
> VARINT, DECIMAL and INET). Then, IndexContext would hold the adequate
> instance of TermType. This instance would be able to provide the same
> operations as the current TypeUtil, but without the type checks.{quote}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]