Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"cases": [
"explain format='brief' select * from t1 where fts_match_word('hello', title)",
"explain format='brief' select * from t1 where fts_match_phrase('hello', title)",
"explain format='brief' select title from t1 where fts_match_word('hello', title)",
"explain format='brief' select * from t1 where fts_match_prefix('hello', title)",
"explain format='brief' select * from t1 where fts_match_prefix('hello', title) and id = 10",
"explain format='brief' select id from t1 where fts_match_word('hello', title)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
],
"Warn": null
},
{
"SQL": "explain format='brief' select title from t1 where fts_match_word('hello', title)",
"Plan": [
"IndexReader 1000.00 root index:IndexRangeScan",
"└─IndexRangeScan 1000.00 cop[tici] table:t1, index:idx_title(title) range:[-inf,+inf], search func:fts_match_word(\"hello\", test.t1.title), keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format='brief' select * from t1 where fts_match_prefix('hello', title)",
"Plan": [
Expand Down
6 changes: 5 additions & 1 deletion pkg/planner/core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,21 @@ func fillIndexPath(ds *logicalop.DataSource, path *util.AccessPath, conds []expr
if path.Index.IsTiCIIndex() {
if path.Index.HybridInfo != nil && path.Index.HybridInfo.Sharding != nil {
ticiType = distsql.TiCIShardExtraShardingKey
path.Ranges = ranger.FullRange()
} else if ds.TableInfo.IsCommonHandle {
ticiType = distsql.TiCIShardCommonHandle
path.Ranges = ranger.FullRange()
} else {
ticiType = distsql.TiCIShardIntHandle
// Int Handle's range is a special one.
path.Ranges = ranger.FullIntRange(mysql.HasUnsignedFlag(ds.TableInfo.GetPkColInfo().GetFlag()))
}
path.IdxCols, path.IdxColLens = expression.TiCIIndexInfo2ShardCols(ds.Columns, ds.Schema().Columns, path.Index, possiblePK)
} else {
path.IdxCols, path.IdxColLens = expression.IndexInfo2PrefixCols(ds.Columns, ds.Schema().Columns, path.Index)
path.Ranges = ranger.FullRange()
}
path.FullIdxCols, path.FullIdxColLens = expression.IndexInfo2Cols(ds.Columns, ds.Schema().Columns, path.Index)
path.Ranges = ranger.FullRange()
path.CountAfterAccess = float64(ds.StatisticTable.RealtimeCount)
path.MinCountAfterAccess = 0
path.MaxCountAfterAccess = 0
Expand Down