feat: Customizable column types and validators #160
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.
Signed-off-by: Yevhenii Melnyk melnyk.yevhenii@gmail.com
Partially closes #36.
Rationale for the change
I'd like to introduce column type verification for Datafusion apache/datafusion#4499.
In order to let downstream users of
sqllogictest-rs
to define custom column types and validation strategies, I suggest introducing a pluggable column type. This way differentAsynDB
andDB
implementations would be able to define column types beyond the original 'T','I','R' like CocroachDB does, or shrinking the set of columns to only havingI
like DuckDB suggests.Changes
This pr introduces an interface
ColumnType
and a default implementationDefaultColumnType
that is similar to the original Sqllites type, except that it accepts any letters and parses them as an "Any" type.Another change is a customizable validator for columns in results. By default, the behaviour is the same as before: neither the number nor type of the columns is validated.
Changes visible to the client
AsyncDB
andDB
implementations would need to explicitly define an associated typeColumnType
.run
method would need to change the definitionColumnType::Any
->DefaultColumnType::Any
update_test_file
would change fromupdate_test_file(.., runner, ..)
torunner.update_test_file(...)