Open rcaudy opened 2 years ago
I've had a related idea that I think you will love.
I believe that, similar to TableUpdateValidator
that we can write up a light-weight TableAttributeValidator
that incrementally proves invariants. Such as TABLE_IS_FLAT
, TABLE_IS_ADD_ONLY
. It would be nice to extend these to columns like COLUMN_IS_SORTED
, COLUMN_IS_SINGLETON_ROW
(this yields a very performant optimization for CROSS_JOIN -- which is a useful feature when exploring mathematical models. EDIT: consider this optimization a key-less naturalJoin -- we can always use the leftTable's index or an emptyIndex without maintaining any join state at all).
I'm sure there are even more interesting invariants that are cheap to verify incrementally.
Using these attributes we could make future optimizations -- such as don't sort, if it's already sorted (or reverse, if it's sorted in the wrong direction).
We could potentially have a "cheap" validation version of COLUMN_IS_UNIQUE
using a bloom filter to warn on a potential duplicate value. That is, on warning, a user could:
where(X = potentialDuplicateValue)
)
Do the equivalent to: