Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-18590

Introduce IndexTermType to replace TypeUtils in SAI

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • 5.0-beta1, 5.0, 5.1
    • Feature/SAI
    • 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

          Activity

            People

              mike_tr_adamson Mike Adamson
              mike_tr_adamson Mike Adamson
              Mike Adamson
              Caleb Rackliffe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: