control substitution on statement ok CREATE EXTERNAL TABLE indexed_vcf_table STORED AS INDEXED_VCF LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/vcf/index.vcf.gz' OPTIONS (compression gzip); # If we try to select from a statement w/o a region filter we should get an error. statement error SELECT * FROM indexed_vcf_table; # If we try to select from a statement w/ a region filter we should not get an error. statement ok SELECT * FROM indexed_vcf_table WHERE vcf_region_filter('1', chrom) = true; # Clean up after the test statement ok DROP TABLE indexed_vcf_table; statement ok CREATE EXTERNAL TABLE vcf_table STORED AS INDEXED_VCF PARTITIONED BY (sample) LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/vcf-partition' OPTIONS (compression gzip); # Test that zero rows are returned when the region filter does not match any rows. query T SELECT COUNT(*) FROM vcf_table WHERE vcf_region_filter('a', chrom) = true; ---- 0 query T SELECT chrom, sample, COUNT(*) AS cnt FROM vcf_table WHERE vcf_region_filter('1', chrom) = true AND sample = '1' GROUP BY chrom, sample ORDER BY chrom, sample; ---- 1 1 191 query T SELECT COUNT(*) AS cnt FROM vcf_table WHERE vcf_region_filter('1', chrom) = true ---- 382 statement ok DROP TABLE vcf_table; query T SELECT COUNT(*) FROM vcf_indexed_scan('$CARGO_MANIFEST_DIR/test-data/datasources/vcf-partition', '1'); ---- 382 statement ok CREATE EXTERNAL TABLE vcf_table STORED AS INDEXED_VCF LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/biobear-vcf/vcf_file.vcf.gz' OPTIONS (compression gzip); statement error SELECT COUNT(*) FROM vcf_table; query T SELECT COUNT(*) FROM vcf_table WHERE vcf_region_filter('1000', chrom) = true; ---- 0 query T SELECT COUNT(*) FROM vcf_table WHERE vcf_region_filter('1', chrom) = true; ---- 11 statement ok DROP TABLE vcf_table;