CNDB-12774: Not index empty non-literal values #1556
                
     Merged
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    


Skip indexing empty non-literal values.
Ideally we should index those empty values to have the same behaviour as legacy table-based secondary indexes. However, SAI has never been able to index values non-literal values. CASSANDRA-19461 was meant to add support for this, but it only did it correctly for literal types (
text,ascii,booleanand froze multicells), breaking index building for all other types.I think that, until we have a good way to represent empty values in the KD tree, we should skip indexing empty non-literal types, rather than fail the entire index build.
It's worth mentioning that all the types whose empty values will be ignored return
trueinAbstractType#isEmptyValueMeaningless. This means that an empty binary value doesn't represent any composed value. That way, type composition always presents these values asnull.Also, this patch prevents an encoding error when searching empty
varintanddecimalvalues.