@@ -183,6 +183,54 @@ func TestUnionScanForMemBufferReader(t *testing.T) {
183
183
}
184
184
}
185
185
186
+ func TestIssue53951 (t * testing.T ) {
187
+ store := testkit .CreateMockStore (t )
188
+ tk := testkit .NewTestKit (t , store )
189
+ tk .MustExec ("use test" )
190
+ tk .MustExec (`CREATE TABLE gholla_dummy1 (
191
+ id varchar(10) NOT NULL,
192
+ mark int,
193
+ deleted_at datetime(3) NOT NULL DEFAULT '1970-01-01 01:00:01.000',
194
+ account_id varchar(10) NOT NULL,
195
+ metastore_id varchar(10) NOT NULL,
196
+ is_deleted tinyint(1) GENERATED ALWAYS AS ((deleted_at > _utf8mb4'1970-01-01 01:00:01.000')) VIRTUAL NOT NULL,
197
+ PRIMARY KEY (account_id,metastore_id,id),
198
+ KEY isDeleted_accountId_metastoreId (is_deleted,account_id,metastore_id)
199
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;` )
200
+ tk .MustExec (`CREATE TABLE gholla_dummy2 (
201
+ id varchar(10) NOT NULL,
202
+ mark int,
203
+ deleted_at datetime(3) NOT NULL DEFAULT '1970-01-01 01:00:01.000',
204
+ account_id varchar(10) NOT NULL,
205
+ metastore_id varchar(10) NOT NULL,
206
+ is_deleted tinyint(1) GENERATED ALWAYS AS ((deleted_at > _utf8mb4'1970-01-01 01:00:01.000')) VIRTUAL NOT NULL,
207
+ PRIMARY KEY (account_id,metastore_id,id),
208
+ KEY isDeleted_accountId_metastoreId (is_deleted,account_id,metastore_id)
209
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ` )
210
+ tk .MustExec (`INSERT INTO gholla_dummy1 (id,mark,deleted_at,account_id,metastore_id) VALUES ('ABC', 1, '1970-01-01 01:00:01.000', 'ABC', 'ABC');` )
211
+ tk .MustExec (`INSERT INTO gholla_dummy2 (id,mark,deleted_at,account_id,metastore_id) VALUES ('ABC', 1, '1970-01-01 01:00:01.000', 'ABC', 'ABC');` )
212
+ tk .MustExec (`start transaction;` )
213
+ tk .MustExec (`update gholla_dummy2 set deleted_at = NOW(), mark=2 where account_id = 'ABC' and metastore_id = 'ABC' and id = 'ABC';` )
214
+ tk .MustQuery (`select
215
+ /*+ INL_JOIN(g1, g2) */
216
+ g1.account_id,
217
+ g2.mark
218
+ from
219
+ gholla_dummy1 g1 FORCE INDEX(isDeleted_accountId_metastoreId)
220
+ STRAIGHT_JOIN
221
+ gholla_dummy2 g2 FORCE INDEX (PRIMARY)
222
+ ON
223
+ g1.account_id = g2.account_id AND
224
+ g1.metastore_id = g2.metastore_id AND
225
+ g1.id = g2.id
226
+ WHERE
227
+ g1.account_id = 'ABC' AND
228
+ g1.metastore_id = 'ABC' AND
229
+ g1.is_deleted = FALSE AND
230
+ g2.is_deleted = FALSE;` ).Check (testkit .Rows ()) // empty result, no error
231
+ tk .MustExec (`rollback` )
232
+ }
233
+
186
234
func TestIssue28073 (t * testing.T ) {
187
235
store := testkit .CreateMockStore (t )
188
236
tk := testkit .NewTestKit (t , store )
0 commit comments