control substitution on statement ok CREATE EXTERNAL TABLE bam STORED AS INDEXED_BAM LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/bam/'; query T SELECT name, flag, reference, start, end, mapping_quality, cigar FROM bam WHERE bam_region_filter('chr1:1-12209145', reference, start, end) = true LIMIT 1; ---- READ_ID 83 chr1 12203704 12217173 NULL 55M13394N21M query T SELECT COUNT(*) AS cnt FROM bam WHERE bam_region_filter('chr1:1-12209145', reference, start, end) = true; ---- 7 statement ok DROP TABLE bam; statement ok CREATE EXTERNAL TABLE bam_multi STORED AS INDEXED_BAM LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/bam-multifile/'; query T SELECT COUNT(*) AS cnt FROM bam_multi WHERE bam_region_filter('chr1:1-12209145', reference, start, end) = true; ---- 14 statement ok DROP TABLE bam_multi; statement ok CREATE EXTERNAL TABLE bam_part STORED AS INDEXED_BAM PARTITIONED BY (sample) LOCATION '$CARGO_MANIFEST_DIR/test-data/datasources/bam-partition/'; query T SELECT sample, COUNT(reference) cnt FROM bam_part WHERE bam_region_filter('chr1:1-12209145', reference, start, end) = true AND sample = '2' GROUP BY sample; ---- 2 7 query T SELECT sample, COUNT(reference) cnt FROM bam_part WHERE bam_region_filter('chr1:1-12209145', reference, start, end) = true GROUP BY sample ORDER BY sample; ---- 1 7 2 7 statement ok DROP TABLE bam_part; query T SELECT COUNT(*) FROM bam_indexed_scan('$CARGO_MANIFEST_DIR/test-data/datasources/bam-partition/', 'chr1:1-12209145'); ---- 14