pingcap / pingcap/tiflash

using a json column as a predicate returns unexpected results

Open
#10,536 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/compute contribution type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)
DROP TABLE IF EXISTS tb1;
CREATE TABLE tb1 (id INT UNIQUE AUTO_INCREMENT NOT NULL, c1 JSON);
INSERT INTO tb1(c1) VALUES ('"JzdL6mft"');

ALTER TABLE tb1 SET TIFLASH REPLICA 1;

SELECT /*+ read_from_storage(tikv[t0]) */ t0.c1 AS col_0 FROM tb1 AS t0 WHERE t0.c1;
SELECT /*+ read_from_storage(tiflash[t0]) */ t0.c1 AS col_0 FROM tb1 AS t0 WHERE t0.c1;

2. What did you expect to see? (Required)
mysql> SELECT /*+ read_from_storage(tikv[t0]) */ t0.c1 AS col_0 FROM tb1 AS t0 WHERE t0.c1;
+------------+
| col_0      |
+------------+
| "JzdL6mft" |
+------------+
1 row in set (0.002 sec)
3. What did you see instead (Required)
mysql> SELECT /*+ read_from_storage(tiflash[t0]) */ t0.c1 AS col_0 FROM tb1 AS t0 WHERE t0.c1;
Empty set (0.008 sec)
4. What is your TiFlash version? (Required)
mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-250-ga6d415f24a
Edition: Community
Git Commit Hash: a6d415f24a7d182ebca3d189c457d9044537028f
Git Branch: HEAD
UTC Build Time: 2025-08-03 10:01:12
GoVersion: go1.23.11
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided SQL reproduction against the TiKV and TiFlash storage hints on the stated TiFlash version, then trace the predicate handling for the JSON column. Done means both queries return the inserted JSON value consistently, with a regression test covering the case; the issue names no source files or existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.