-
Notifications
You must be signed in to change notification settings - Fork 102
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
MLDB-2105 sql square bracket enh + test update #836
base: master
Are you sure you want to change the base?
Conversation
""" | ||
It doesn't matter that it maches, it's a string. | ||
""" | ||
res = mldb.query("SELECT a[foo] FROM (SELECT {foo: 123} AS a)") | ||
self.assertEqual(res, [ | ||
['_rowName', "a[foo]"], | ||
['_rowName', "a.foo"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever the operator used in the query, the result uses the dot notation.
def test_inner_whitespaces_double_quotes(self): | ||
res = mldb.query(""" | ||
SELECT a["f b"] FROM ( | ||
SELECT parse_json('{"f b" : 123}') AS a | ||
) | ||
""") | ||
self.assertEqual(res, [ | ||
['_rowName', "a[f b]"], | ||
['_rowName', "a.f b"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dot notation returns non "round trippable" result though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok never mind, MLDB returns that already when we do something like
SELECT a."f b"
+1 with some hesitation... now the bracket operator will mean slightly different things when whats on the left is an identifier and when its not. When its an identifier, it'll only select a column from it. When its any row expression on the left, it'll allow evaluation of an expression in the context of that row expression. |
@jeremybarnes What do you think? |
I think that this needs to be thought through more. We're now making the . an operator that can be used anywhere; I think it's unclear what the precedence is and how it interacts with other lexical constructs that include dots. To me, [] and . are different constructs syntactically, it just so happens that . is implemented in terms of []. Let's keep the code cleanup, and do a whiteboard session on the semantics. |
No description provided.