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

TableName not removed when pushing predicates in derived tables #8976

Closed
GuptaManan100 opened this issue Oct 11, 2021 · 0 comments · Fixed by #8977
Closed

TableName not removed when pushing predicates in derived tables #8976

GuptaManan100 opened this issue Oct 11, 2021 · 0 comments · Fixed by #8977

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

Running the following query returns an error in gen4.

 select table_name from (select * from information_schema.`tables` where table_schema = database()) as _subquery where _subquery.table_type = 'a' and _subquery.table_name = 'a'

The plan produced from Gen4 is

{
  "QueryType": "SELECT",
  "Original": "select table_name from (select * from information_schema.`tables` where table_schema = database()) as _subquery where _subquery.table_type = 'a' and _subquery.table_name = 'a'",
  "Instructions": {
    "OperatorType": "Route",
    "Variant": "SelectDBA",
    "Keyspace": {
      "Name": "main",
      "Sharded": false
    },
    "FieldQuery": "select table_name from (select * from information_schema.`tables` where 1 != 1) as _subquery where 1 != 1",
    "Query": "select table_name from (select * from information_schema.`tables` where table_schema = database() and _subquery.table_type = 'a' and _subquery.table_name = :_subquery_table_name) as _subquery",
    "SysTableTableName": "[_subquery_table_name:VARBINARY(\"a\")]",
    "Table": "information_schema.`tables`"
  }
}

The alias of the derived table is not removed while pushing the predicates inside.

Reproduction Steps

Steps to reproduce this issue:

  1. Copy the query to onecase.txt and run the plan tests.

Binary version

main

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

Successfully merging a pull request may close this issue.

2 participants