Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error: invalid memory address or nil pointer dereference when run query with tidb_opt_enable_hash_join=off #54072

Closed
tiancaiamao opened this issue Jun 18, 2024 · 1 comment

Comments

@tiancaiamao
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

directory_query.zip

With the plan replayer file above

plan replayer load '/tmp/directory_query.zip';

Set tidb_opt_enable_hash_join to off and run query.

mysql> set session tidb_opt_enable_hash_join = "off";
Query OK, 0 rows affected (0.00 sec)

mysql> explain WITH RECURSIVE ancestors(gid) AS (    SELECT     groupings.parentId   FROM     groupings   WHERE     (       groupings.userId = 8329216799209537       OR groupings.groupId = 8329216799209537     )     AND groupings.parentId IN (       SELECT         groupId       FROM         `groups`       WHERE         `groups`.workspaceid = 4094233125760157         OR `groups`.accountId = '02945107-4221-4317-9276-5e0e9ed7f194'     )     AND groupings.internal_deleted_timestamp IS NULL   UNION   SELECT     groupings.parentId   FROM     groupings     JOIN ancestors ON groupings.groupId = ancestors.gid ),workspaceScopedGroups(gid) AS (   SELECT     groupId   FROM     principalToWorkspace   WHERE     groupId IN (       SELECT         gid       FROM         ancestors     )     AND principalToWorkspace.deleted = false     AND principalToWorkspace.workspaceId = 4094233125760157   UNION   SELECT     groupings.groupId   FROM     groupings     JOIN workspaceScopedGroups ON groupings.parentId = workspaceScopedGroups.gid   WHERE     groupings.groupId IN (       SELECT         gid
    FROM         ancestors     ) ) SELECT   `groups`.groupId AS "`groups`.groupId",   `groups`.groupname AS "`groups`.groupname",   `groups`.externalId AS "`groups`.externalId",   `groups`.creationTime AS "`groups`.creationTime",   `groups`.groupuuid AS "`groups`.groupuuid",   `groups`.accountId AS "`groups`.accountId",   `groups`.syncedBy AS "`groups`.syncedBy",   `groups`.sourceIdp AS "`groups`.sourceIdp" FROM   `groups` WHERE   `groups`.groupId IN (     SELECT       gid     FROM       workspaceScopedGroups   );
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

2. What did you expect to see? (Required)

With set session tidb_opt_enable_hash_join = "on" , there is no such error

No ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

I expect tidb_opt_enable_hash_join=off not cause invalid memory address or nil pointer dereference

3. What did you see instead (Required)

No ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

4. What is your TiDB version? (Required)

master(8.2+) , v7.5.1

@hawkingrei
Copy link
Member

it has been fixed by #54449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants