Skip to content

Commit 14f6091

Browse files
authored
Merge pull request #334 from mindsdb/planner-improvents
Planner improvements
2 parents d52abbf + abba2bf commit 14f6091

21 files changed

+1427
-1209
lines changed

mindsdb_sql/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'mindsdb_sql'
22
__package_name__ = 'mindsdb_sql'
3-
__version__ = '0.9.0'
3+
__version__ = '0.10.0'
44
__description__ = "Pure python SQL parser"
55
__email__ = "[email protected]"
66
__author__ = 'MindsDB Inc'

mindsdb_sql/parser/ast/select/native_query.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ def to_tree(self, *args, level=0, **kwargs):
1818
f'NativeQuery(integration={self.integration.to_string()}, query="{self.query}")'
1919

2020
def get_string(self, *args, **kwargs):
21-
return f'{self.integration.to_string()} ({self.query})'
21+
return f'({self.query})'
22+
23+
def __repr__(self):
24+
return f'{self.__class__.__name__}:{self.integration.to_string()} ({self.query})'

mindsdb_sql/parser/dialects/mindsdb/parser.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,15 @@ def database_engine(self, p):
935935
return {'identifier':p.identifier, 'engine':engine, 'if_not_exists':p.if_not_exists_or_empty}
936936

937937
# UNION / UNION ALL
938-
@_('select UNION select')
938+
@_('select UNION select',
939+
'union UNION select')
939940
def union(self, p):
940-
return Union(left=p.select0, right=p.select1, unique=True)
941+
return Union(left=p[0], right=p[2], unique=True)
941942

942-
@_('select UNION ALL select')
943+
@_('select UNION ALL select',
944+
'union UNION ALL select',)
943945
def union(self, p):
944-
return Union(left=p.select0, right=p.select1, unique=False)
946+
return Union(left=p[0], right=p[3], unique=False)
945947

946948
# tableau
947949
@_('LPAREN select RPAREN')
@@ -1245,8 +1247,7 @@ def result_column(self, p):
12451247

12461248
@_('expr',
12471249
'function',
1248-
'window_function',
1249-
'case')
1250+
'window_function')
12501251
def result_column(self, p):
12511252
return p[0]
12521253

@@ -1444,6 +1445,7 @@ def enumeration(self, p):
14441445
'parameter',
14451446
'constant',
14461447
'latest',
1448+
'case',
14471449
'function')
14481450
def expr(self, p):
14491451
return p[0]

0 commit comments

Comments
 (0)