Details
-
Improvement
-
Status: Resolved
-
Normal
-
Resolution: Duplicate
-
None
-
Code Clarity
-
Normal
-
All
-
None
Description
From a review comment by adelapena on the CASSANDRA-18067 PR
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.
Attachments
Issue Links
- Is contained by
-
CASSANDRA-18166 Improve the code model around IndexContext
- Resolved