forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(query): fix match function panic in native format (databendlabs#1…
…5402) * fix(query): fix match function panic in native format * fix tests
- Loading branch information
Showing
5 changed files
with
185 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
tests/sqllogictests/suites/mode/standalone/ee/explain_inverted_index.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
## Copyright 2023 Databend Cloud | ||
## | ||
## Licensed under the Elastic License, Version 2.0 (the "License"); | ||
## you may not use this file except in compliance with the License. | ||
## You may obtain a copy of the License at | ||
## | ||
## https://www.elastic.co/licensing/elastic-license | ||
## | ||
## Unless required by applicable law or agreed to in writing, software | ||
## distributed under the License is distributed on an "AS IS" BASIS, | ||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
## See the License for the specific language governing permissions and | ||
## limitations under the License. | ||
|
||
statement ok | ||
DROP DATABASE IF EXISTS test_inverted_index_db | ||
|
||
statement ok | ||
CREATE DATABASE test_inverted_index_db | ||
|
||
statement ok | ||
USE test_inverted_index_db | ||
|
||
statement ok | ||
DROP TABLE IF EXISTS t1 | ||
|
||
statement ok | ||
CREATE TABLE t1 (id int, content string) row_per_block=2 storage_format='parquet' | ||
|
||
statement ok | ||
CREATE INVERTED INDEX IF NOT EXISTS idx1 ON t1(content) | ||
|
||
statement ok | ||
INSERT INTO t1 VALUES | ||
(1, 'The quick brown fox jumps over the lazy dog'), | ||
(2, 'A picture is worth a thousand words'), | ||
(3, 'The early bird catches the worm'), | ||
(4, 'Actions speak louder than words'), | ||
(5, 'Time flies like an arrow; fruit flies like a banana'), | ||
(6, 'Beauty is in the eye of the beholder'), | ||
(7, 'When life gives you lemons, make lemonade'), | ||
(8, 'Put all your eggs in one basket'), | ||
(9, 'You can not judge a book by its cover'), | ||
(10, 'An apple a day keeps the doctor away') | ||
|
||
query T | ||
EXPLAIN SELECT id, content FROM t1 WHERE query('content:"early bird"') | ||
---- | ||
Filter | ||
├── output columns: [t1.id (#0), t1.content (#1)] | ||
├── filters: [t1._search_matched (#2)] | ||
├── estimated rows: 10.00 | ||
└── TableScan | ||
├── table: default.test_inverted_index_db.t1 | ||
├── output columns: [id (#0), content (#1), _search_matched (#2)] | ||
├── read rows: 2 | ||
├── read size: < 1 KiB | ||
├── partitions total: 5 | ||
├── partitions scanned: 1 | ||
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 5 to 5, inverted pruning: 5 to 1>] | ||
├── push downs: [filters: [t1._search_matched (#2)], limit: NONE] | ||
└── estimated rows: 10.00 | ||
|
||
statement ok | ||
DROP TABLE IF EXISTS t2 | ||
|
||
statement ok | ||
CREATE TABLE t2 (id int, content string) row_per_block=2 storage_format='native' | ||
|
||
statement ok | ||
CREATE INVERTED INDEX IF NOT EXISTS idx1 ON t2(content) | ||
|
||
statement ok | ||
INSERT INTO t2 VALUES | ||
(1, 'The quick brown fox jumps over the lazy dog'), | ||
(2, 'A picture is worth a thousand words'), | ||
(3, 'The early bird catches the worm'), | ||
(4, 'Actions speak louder than words'), | ||
(5, 'Time flies like an arrow; fruit flies like a banana'), | ||
(6, 'Beauty is in the eye of the beholder'), | ||
(7, 'When life gives you lemons, make lemonade'), | ||
(8, 'Put all your eggs in one basket'), | ||
(9, 'You can not judge a book by its cover'), | ||
(10, 'An apple a day keeps the doctor away') | ||
|
||
query T | ||
EXPLAIN SELECT id, content FROM t2 WHERE query('content:"early bird"') | ||
---- | ||
Filter | ||
├── output columns: [t2.id (#0), t2.content (#1)] | ||
├── filters: [t2._search_matched (#2)] | ||
├── estimated rows: 10.00 | ||
└── TableScan | ||
├── table: default.test_inverted_index_db.t2 | ||
├── output columns: [id (#0), content (#1), _search_matched (#2)] | ||
├── read rows: 2 | ||
├── read size: < 1 KiB | ||
├── partitions total: 5 | ||
├── partitions scanned: 1 | ||
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 5 to 5, inverted pruning: 5 to 1>] | ||
├── push downs: [filters: [t2._search_matched (#2)], limit: NONE] | ||
└── estimated rows: 10.00 | ||
|
||
statement ok | ||
USE default | ||
|
||
statement ok | ||
DROP DATABASE IF EXISTS test_inverted_index_db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters