diff --git a/pkg/planner/core/casetest/tici/testdata/tici_index_suite_in.json b/pkg/planner/core/casetest/tici/testdata/tici_index_suite_in.json index 4f083dfc0845d..889d13d82d073 100644 --- a/pkg/planner/core/casetest/tici/testdata/tici_index_suite_in.json +++ b/pkg/planner/core/casetest/tici/testdata/tici_index_suite_in.json @@ -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)", diff --git a/pkg/planner/core/casetest/tici/testdata/tici_index_suite_out.json b/pkg/planner/core/casetest/tici/testdata/tici_index_suite_out.json index 8c174bc796c6a..f0147165e1212 100644 --- a/pkg/planner/core/casetest/tici/testdata/tici_index_suite_out.json +++ b/pkg/planner/core/casetest/tici/testdata/tici_index_suite_out.json @@ -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": [ diff --git a/pkg/planner/core/stats.go b/pkg/planner/core/stats.go index c24efe717e9fc..c6e630d92ed63 100644 --- a/pkg/planner/core/stats.go +++ b/pkg/planner/core/stats.go @@ -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