Add tests for unsupported types

This commit is contained in:
Colin Dellow 2018-03-04 13:02:42 -05:00
parent 681c8a443f
commit a4f368af9c
4 changed files with 42 additions and 1 deletions

2
.gitignore vendored
View File

@ -39,3 +39,5 @@
/sqlite-autoconf*
/cmds.txt
/sqlite-with-parquet
/testcase-out.txt
/testcase-err.txt

View File

@ -79,7 +79,9 @@ def write_unsupported_parquets():
pa.null(),
pa.uint8(),
pa.uint16(),
pa.uint32(),
# per https://issues.apache.org/jira/browse/ARROW-436, I think
# Parquet v1.0 can't serialize UINT32
#pa.uint32(),
pa.uint64(),
# pa.float16() <-- not supported by us, but also not by pyarrow
# TODO: list_, struct, dict

37
tests/test-unsupported Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail
# Verify that all the unsupported.*parquet files result in an error when creating the virtual table,
# but don't segfault.
load_unsupported() {
file=${1:?must provide file to load}
basename=$(basename "$file")
cat <<EOF
.echo on
.load parquet/libparquet
.testcase $basename
.bail on
CREATE VIRTUAL TABLE test USING parquet('$file');
SELECT 123;
EOF
}
main() {
root=$(dirname "${BASH_SOURCE[0]}")/..
root=$(readlink -f "$root")
cd "$root"
unsupported_files=$(find . -type f -name 'unsupported*.parquet')
while read -r unsupported; do
echo "Testing: $unsupported"
"$root"/sqlite/sqlite3 -init <(load_unsupported "$unsupported") < /dev/null > /dev/null 2> testcase-err.txt
# We expect the 'SELECT 123' command to NOT have been run
if grep -q 123 testcase-out.txt; then
echo "...FAILED" >&2
exit 1
fi
done < <(echo "$unsupported_files")
}
main "$@"