Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: enable indexing and ordering on arrays of orderable and indexable types #48045

Merged
merged 1 commit into from
May 9, 2020

Commits on May 6, 2020

  1. sql: enable indexing and ordering on arrays of orderable and indexabl…

    …e types
    
    Fixes cockroachdb#17154.
    Fixes cockroachdb#35707.
    
    This PR enables arrays to be ordered and indexed by
    introducing an ordered key encoding for arrays.
    Once this exists, the rest of the SQL infrastructure
    is ready to handle indexing and ordering on arrays.
    
    To encode an array of elements `ARRAY[a, b]`,
    we create the following encoding.
    
    Let `AM` = a marker byte for arrays and let `AT` be a terminator byte.
    
    `enc(ARRAY[a, b]) = [AM, enc(a), enc(b), AT]`
    
    The key is that the terminator is less than the element marker.
    This allows for the "prefix matching" style comparison that
    arrays support.
    
    Release note (sql change): This PR adds support for indexing
    and ordering of arrays of indexable and orderable inner types.
    rohany committed May 6, 2020
    Configuration menu
    Copy the full SHA
    60cb535 View commit details
    Browse the repository at this point in the history