Conversation
|
@himanshug any reason we are rolling our own parser / lexer instead of levering antlr or something similar? |
|
@xvrl mostly because parser/lexer is simple/small for this grammar (see the number of lines with real code in Lexer/Parser class), having it implemented here means less magic. All the rest of the code would be needed whether you used ANTLR or not. |
|
@himanshug we already have a build-time dependency for antlr that's used for the toy sql grammar I wrote a while back. We could use antlr to remove all the boilerplate code and reduce the chance of bugs. I think it would make it easier to extend / understand for other folks, and remove a lot of boilerplate code. |
There was a problem hiding this comment.
Precedence is generally shown in decreasing order.
There's a missing "the" in front of "following operators".
|
@xvrl i agree with "understandability and extensibility" point, I will try to generate lexer/parser with antlr. |
91b6424 to
b0aca0a
Compare
There was a problem hiding this comment.
needs "the" before "following" - sorry I didn't say that before.
|
@himanshug we need docs on how to use this in queries |
|
👍 This can be for later, but any thoughts on whether it's useful to expand this with more supported math expressions? e.g. trigonometric functions, ln, e^x? |
|
@jon-wei yes, I will be adding more math functions, this PR sets up the framework really... adding more math functions would be trivial. |
|
@himanshug Is it necessary to remove our toy-sql runner? :) |
|
@navis had to remove that because it was written with an older version of antlr and was broken with antlr4. older version required writing grammar and implementation details in the same file which was messy. |
|
👍 wanna use this. |
|
@himanshug Could you rebase this? Let get this in. |
|
@fjy The sole conflict is from DruidSql.g4, which was removed in this PR. I've asked @himanshug on it before but can we remove it and proceed? |
|
@himanshug This needs docs |
|
@fjy pls see #2090 (comment) |
|
👍 |
|
@xvrl I can't not commit and squash? |
|
@xvrl nvm updated settings |
|
@fjy from now on you just hit the "confirm squash and merge" button, I disabled the old merge as indicated in the mailing list. |
|
This PR delete ExprLexer and ExprParser and those classes still a dependency of alot of components. |
this PR adds a math expression implementation to be used in #1965, possibly as a post aggregator and some other places to query. I will send/update those PR once this one is merged.
pls see math-expr.md for the quick overview/documentation.
also, experimental DruidSQL.g4 is removed because it was failing with newer version of ANTLR, can bring it back and fix if/when needed.