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

repaire debug slow bug #141

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/api/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"""

from src.optimizer.optimizer import Optimizer
from src.parser.mysql_parser.parser import parser as mysql_parser
from src.parser.mysql_parser.lexer import lexer as mysql_lexer
from src.parser.mysql_parser import parser as mysql_parser
from src.parser.parser_utils import ParserUtils
from src.common.utils import Utils

Expand All @@ -30,9 +29,7 @@ def get_xml_log_details(sql_text, catalog_object):
after_sql_rewrite,
) = optimizer.optimize(sql_text, catalog_object)

visitor = ParserUtils.format_statement(
mysql_parser.parse(sql_text, lexer=mysql_lexer)
)
visitor = ParserUtils.format_statement(mysql_parser.parse(sql_text))
table_list = []
for _table in visitor.table_list:
table_list.append(_table['table_name'])
Expand Down
7 changes: 2 additions & 5 deletions src/api/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
from src.common.utils import Utils
from src.metadata.metadata_utils import MetaDataUtils
from src.optimizer.optimizer import Optimizer as opt
from src.parser.mysql_parser.parser import parser as mysql_parser
from src.parser.mysql_parser.lexer import lexer as mysql_lexer
from src.parser.mysql_parser import parser as mysql_parser
from src.parser.parser_utils import ParserUtils

NOTHING_TO_DO = 'Current table index is so good , nothing to do'
Expand Down Expand Up @@ -192,9 +191,7 @@ def get(self):
description: parse result
"""
sql_text = Utils.remove_sql_text_affects_parser(self.sql_text)
visitor = ParserUtils.format_statement(
mysql_parser.parse(sql_text, lexer=mysql_lexer)
)
visitor = ParserUtils.format_statement(mysql_parser.parse(sql_text))
table_list = visitor.table_list
column_list = []
temp_table_list = []
Expand Down
7 changes: 3 additions & 4 deletions src/metadata/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

from src.metadata.catalog import Catalog, Statistics, Selectivity, Table, Index, Column
from src.optimizer.optimizer_enum import IndexType, OptType
from src.parser.mysql_parser.parser import parser as mysql_parser
from src.parser.mysql_parser.lexer import lexer as mysql_lexer
from src.parser.mysql_parser import parser as mysql_parser


class MetaDataUtils(object):
Expand All @@ -30,7 +29,7 @@ def schema_sql_to_catalog_index(schema_sql):
for ddl_sql in schema_sql.split(';'):
if not ddl_sql:
break
res = mysql_parser.parse(ddl_sql, lexer=mysql_lexer)
res = mysql_parser.parse(ddl_sql)
table_name = res['table_name']
element_list = res['element_list']
index_list = res['index_list']
Expand Down Expand Up @@ -95,7 +94,7 @@ def json_to_catalog(catalog_json, schema_sql=None) -> Catalog:
for ddl_sql in schema_sql.split(';'):
if not ddl_sql:
break
res = mysql_parser.parse(ddl_sql, lexer=mysql_lexer)
res = mysql_parser.parse(ddl_sql)
table_name = res['table_name']
element_list = res['element_list']
index_list = res['index_list']
Expand Down
5 changes: 2 additions & 3 deletions src/optimizer/mysql_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"""

from src.optimizer.engine import Engine
from src.parser.mysql_parser.parser import parser as mysql_parser
from src.parser.mysql_parser.lexer import lexer as mysql_lexer
from src.parser.mysql_parser import parser as mysql_parser
from .rewrite_rule import mysql_rules, common_rules


Expand All @@ -27,7 +26,7 @@ def __new__(cls):
return singleton

def parse(self, sql, tracking=False):
return mysql_parser.parse(sql, lexer=mysql_lexer, tracking=tracking)
return mysql_parser.parse(sql, tracking=tracking)

def rewrite(self, statement, catalog=None):
common_rules.extend(mysql_rules)
Expand Down
5 changes: 2 additions & 3 deletions src/optimizer/oceanbase_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"""

from src.optimizer.engine import Engine
from src.parser.oceanbase_parser.parser import parser as oceanbase_parser
from src.parser.oceanbase_parser.lexer import lexer as oceanbase_lexer
from src.parser.oceanbase_parser import parser as oceanbase_parser
from .rewrite_rule import common_rules


Expand All @@ -27,7 +26,7 @@ def __new__(cls):
return singleton

def parse(self, sql, tracking=False):
return oceanbase_parser.parse(sql, lexer=oceanbase_lexer, tracking=tracking)
return oceanbase_parser.parse(sql, tracking=tracking)

def rewrite(self, statement, catalog=None):
rule_explanation_list = []
Expand Down
Loading