Skip to content

Commit

Permalink
Merge pull request #143 from qidi1/rename_sql_parser_parser
Browse files Browse the repository at this point in the history
remove parser
  • Loading branch information
qidi1 authored Sep 8, 2023
2 parents 5ca0a43 + 1441a02 commit 36a06b2
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 60 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'flasgger',
'ply==3.11',
'chardet==3.0.4',
'sqlgpt-parser>=0.0.1a2',
'sqlgpt-parser>=0.0.1a3',
],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
4 changes: 2 additions & 2 deletions src/api/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"""

from src.optimizer.optimizer import Optimizer
from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser
from sqlgpt_parser.parser.parser_utils import ParserUtils
from src.common.utils import Utils


Expand Down
4 changes: 2 additions & 2 deletions src/api/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from src.common.utils import Utils
from src.metadata.metadata_utils import MetaDataUtils
from src.optimizer.optimizer import Optimizer as opt
from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser
from sqlgpt_parser.parser.parser_utils import ParserUtils

NOTHING_TO_DO = 'Current table index is so good , nothing to do'

Expand Down
6 changes: 3 additions & 3 deletions src/consume/mysql_slowlog_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from src.consume.file_parse_common import get_encoding
from src.consume.mysql_logparser_base import MysqlSlowLogParse
from sqlgpt_parser.format.formatter import format_sql
from sqlgpt_parser.sql_parser.mysql_parser.parser import parser as mysql_parser
from sqlgpt_parser.sql_parser.mysql_parser.lexer import lexer as mysql_lexer
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.mysql_parser.parser import parser as mysql_parser
from sqlgpt_parser.parser.mysql_parser.lexer import lexer as mysql_lexer
from sqlgpt_parser.parser.parser_utils import ParserUtils

log_file = os.path.basename(sys.argv[0]).split(".")[0] + '.log'
log = Logger(log_file)
Expand Down
2 changes: 1 addition & 1 deletion src/metadata/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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


class MetaDataUtils(object):
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/abstract_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from abc import ABCMeta, abstractmethod

from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.statement import Statement


class AbstractRewriteRule(metaclass=ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import List

from src.optimizer.cbo.cbo import CBO
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.statement import Statement
from .heuristic_rule import heuristic_rule_list
from .pmd_rule import common_pmd_list

Expand Down
4 changes: 2 additions & 2 deletions src/optimizer/heuristic_rule/full_scan_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.expression import (
from sqlgpt_parser.parser.tree.expression import (
BetweenPredicate,
ComparisonExpression,
ExistsPredicate,
InPredicate,
LikePredicate,
LogicalBinaryExpression,
)
from sqlgpt_parser.sql_parser.tree import Statement, Query
from sqlgpt_parser.parser.tree import Statement, Query
from .heuristic_rule_return_result import HeuristicRuleReturnResult
from ..abstract_rule import AbstractRewriteRule

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import List

from src.optimizer.optimizer_enum import IndexType
from sqlgpt_parser.sql_parser.tree import Statement
from sqlgpt_parser.parser.tree import Statement
from .heuristic_rule_return_result import HeuristicRuleReturnResult
from ..abstract_rule import AbstractRewriteRule

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from src.optimizer.optimizer_enum import IndexType
from sqlgpt_parser.sql_parser.tree import Statement
from sqlgpt_parser.parser.tree import Statement
from .heuristic_rule_return_result import HeuristicRuleReturnResult
from ..abstract_rule import AbstractRewriteRule

Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/mysql_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from src.optimizer.engine import Engine
from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser
from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser
from .rewrite_rule import mysql_rules, common_rules


Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/oceanbase_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from src.optimizer.engine import Engine
from sqlgpt_parser.sql_parser.oceanbase_parser import parser as oceanbase_parser
from sqlgpt_parser.parser.oceanbase_parser import parser as oceanbase_parser
from .rewrite_rule import common_rules


Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from src.metadata.metadata_utils import MetaDataUtils
from sqlgpt_parser.format.formatter import format_sql
from src.optimizer.optimizer_enum import IndexType
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.parser_utils import ParserUtils
from .cbo.cbo_optimizer import CBOOptimizer
from .oceanbase_engine import OceanBaseEngine
from .prunning_rule.index_prunning import CompareStat, IndexPrunning
Expand Down
6 changes: 3 additions & 3 deletions src/optimizer/pmd_rule/pmd_arithmetic_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
4 changes: 2 additions & 2 deletions src/optimizer/pmd_rule/pmd_count_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
6 changes: 3 additions & 3 deletions src/optimizer/pmd_rule/pmd_full_scan_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.literal import StringLiteral
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.literal import StringLiteral
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
6 changes: 3 additions & 3 deletions src/optimizer/pmd_rule/pmd_is_null_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.literal import NullLiteral
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.literal import NullLiteral
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
6 changes: 3 additions & 3 deletions src/optimizer/pmd_rule/pmd_multi_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.join_criteria import JoinOn, JoinUsing
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
4 changes: 2 additions & 2 deletions src/optimizer/pmd_rule/pmd_nowait_wait_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
10 changes: 5 additions & 5 deletions src/optimizer/pmd_rule/pmd_select_all_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.sql_parser.tree.qualified_name import QualifiedName
from sqlgpt_parser.sql_parser.tree.select_item import SingleColumn
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.parser.tree.qualified_name import QualifiedName
from sqlgpt_parser.parser.tree.select_item import SingleColumn
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
6 changes: 3 additions & 3 deletions src/optimizer/pmd_rule/pmd_update_delete_multi_table_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""

from sqlgpt_parser.sql_parser.tree.relation import Join
from sqlgpt_parser.sql_parser.tree.statement import Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.relation import Join
from sqlgpt_parser.parser.tree.statement import Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from .pmd_enum import PMDLevel
from .pmd_result import PMDResultRule
from ..abstract_rule import AbstractRewriteRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from sqlgpt_parser.sql_parser.tree.statement import Query, Statement
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.statement import Query, Statement
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from ..abstract_rule import AbstractRewriteRule


Expand Down
10 changes: 5 additions & 5 deletions src/optimizer/rewrite_rule/rewrite_or_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from sqlgpt_parser.sql_parser.tree.expression import (
from sqlgpt_parser.parser.tree.expression import (
ComparisonExpression,
InListExpression,
InPredicate,
LogicalBinaryExpression,
QualifiedNameReference,
)
from sqlgpt_parser.sql_parser.tree.query_specification import QuerySpecification
from sqlgpt_parser.sql_parser.tree.set_operation import Union
from sqlgpt_parser.sql_parser.tree.statement import Query, Statement
from sqlgpt_parser.parser.tree.query_specification import QuerySpecification
from sqlgpt_parser.parser.tree.set_operation import Union
from sqlgpt_parser.parser.tree.statement import Query, Statement
from src.optimizer.optimizer_enum import IndexType
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from ..abstract_rule import AbstractRewriteRule


Expand Down
12 changes: 6 additions & 6 deletions src/optimizer/rewrite_rule/rewrite_supplement_column_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from sqlgpt_parser.sql_parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.sql_parser.tree.qualified_name import QualifiedName
from sqlgpt_parser.sql_parser.tree.select_item import SingleColumn
from sqlgpt_parser.sql_parser.tree.statement import Query, Statement
from sqlgpt_parser.sql_parser.tree.table import Table
from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor
from sqlgpt_parser.parser.tree.expression import QualifiedNameReference
from sqlgpt_parser.parser.tree.qualified_name import QualifiedName
from sqlgpt_parser.parser.tree.select_item import SingleColumn
from sqlgpt_parser.parser.tree.statement import Query, Statement
from sqlgpt_parser.parser.tree.table import Table
from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor
from ..abstract_rule import AbstractRewriteRule


Expand Down
2 changes: 1 addition & 1 deletion src/schedule_task/oceanbase/schedule_topsql_oceanbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from src.common.utils import Utils
from src.common.utils import fun_diff_secs, div_list
from src.optimizer.oceanbase_engine import OceanBaseEngine
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.parser_utils import ParserUtils

log_file = os.path.basename(sys.argv[0]).split(".")[0] + '.log'
log = Logger(log_file)
Expand Down
4 changes: 2 additions & 2 deletions test/metadata/test_metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

from src.metadata.catalog import Catalog
from src.metadata.metadata_utils import MetaDataUtils
from sqlgpt_parser.sql_parser.mysql_parser import parser
from sqlgpt_parser.sql_parser.parser_utils import ParserUtils
from sqlgpt_parser.parser.mysql_parser import parser
from sqlgpt_parser.parser.parser_utils import ParserUtils


class MyTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/optimizer/test_pmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
PMDUpdateDeleteMultiTableRule,
PMDMultiTableRule,
)
from sqlgpt_parser.sql_parser.mysql_parser import parser
from sqlgpt_parser.parser.mysql_parser import parser


class MyTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/optimizer/test_rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RemoveOrderByInDeleteUpdateRule,
RewriteSupplementColumnRule,
)
from sqlgpt_parser.sql_parser.mysql_parser import parser
from sqlgpt_parser.parser.mysql_parser import parser


class MyTestCase(unittest.TestCase):
Expand Down

0 comments on commit 36a06b2

Please sign in to comment.