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 optimizer bug ref #150 #151

Merged
merged 2 commits into from
Jan 22, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Thumbs.db
##################
.idea/
.vscode/
build
dist
venv/*
parser.out
parsetab.py
Expand Down
12 changes: 6 additions & 6 deletions db.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
'db': {
'host': 'localhost',
'port': 3306,
'dbname': 'test',
'user': 'root',
'pswd': '123456',
'charset': 'big5'
'host': '*****',
'port': '*',
'dbname': '*',
'user': '*',
'pswd': '*',
'charset': '*'
}
}
7 changes: 6 additions & 1 deletion src/metadata/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,17 @@ def json_to_catalog(catalog_json, schema_sql=None) -> Catalog:

@staticmethod
def extension_all_match_index(filter_column_list, order_list):
column_set = set()
column_list = []
range_flag = False
last_column = ''
for filter_column in filter_column_list:
column_name = filter_column['column_name']
opt = filter_column['opt']
if opt == '=' or opt == 'in' or opt == 'is':
column_list.append(column_name)
if column_name not in column_set:
column_set.add(column_name)
column_list.append(column_name)
elif (
opt == '>'
or opt == '<'
Expand All @@ -221,6 +224,8 @@ def extension_all_match_index(filter_column_list, order_list):
range_flag = True

if range_flag:
if last_column in column_set:
column_list.remove(last_column)
column_list.append(last_column)

# TODO Statistics need to be added to determine which one comes first when there are range queries and sorting
Expand Down
6 changes: 5 additions & 1 deletion src/optimizer/rewrite_rule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from .rewrite_or_rule import RewriteMySQLORRule
from .remove_order_by_in_delete_update_rule import RemoveOrderByInDeleteUpdateRule

common_rules = [RewriteSupplementColumnRule(), RemoveOrderByInDeleteUpdateRule()]
common_rules = [
RewriteSupplementColumnRule(),
RemoveOrderByInDeleteUpdateRule(),
RewriteMySQLORRule(),
]

mysql_rules = [RewriteMySQLORRule()]
Loading