You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hertzbeat.apache.org by "MasamiYui (via GitHub)" <gi...@apache.org> on 2025/04/02 11:07:53 UTC
[D] Use ANTLR DSL to parse expression [hertzbeat]
GitHub user MasamiYui created a discussion: Use ANTLR DSL to parse expression
Now DataSourceService#calculate use regularity and code logic for parse expression, if use ANTLR build dsl, maybe more suitable
Benefit:
1.Better performance with long expressions(Maybe)
2.Enable support for more flexible/complex expressions and function invoke at future
3.More security
Implement:
1.Complete the currently supported expression adaptation
2.Refer to promsql for most features
GitHub link: https://github.com/apache/hertzbeat/discussions/3205
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "tomsun28 (via GitHub)" <gi...@apache.org>.
GitHub user tomsun28 added a comment to the discussion: Use ANTLR DSL to parse expression
hi, when switch sql query, the datasource maybe also gretimedb, beacuse it support sql query. If convert sql to promql, i think it's difficult and error prone. In the future, the usage scenario may be that the query for metrics data may be promql, and the query for log data may be sql. Both of these are supported in greptimedb.
2. Are there any other products with similar functions(support multiple language query)? This is not clear, maybe not.
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12868270
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "MasamiYui (via GitHub)" <gi...@apache.org>.
GitHub user MasamiYui edited a discussion: Use ANTLR DSL to parse expression
Now DataSourceService#calculate use regularity and code logic for parse expression, if use ANTLR build dsl, maybe more suitable
Benefit:
1.Better performance with long expressions(Maybe)
2.Enable support for more flexible/complex expressions and function invoke at future
3.More security
Implement:
1.Complete the currently supported expression adaptation
2.Refer to promsql for more features
GitHub link: https://github.com/apache/hertzbeat/discussions/3205
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "tomsun28 (via GitHub)" <gi...@apache.org>.
GitHub user tomsun28 added a comment to the discussion: Use ANTLR DSL to parse expression
+1 maybe we can have a try. `DataSourceService#calculate` not only for promql like this `promql > 23 and promql < 43`, also we can support SQL calculate like `sql > 23 and xxx`.
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12701596
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "MasamiYui (via GitHub)" <gi...@apache.org>.
GitHub user MasamiYui edited a discussion: Use ANTLR DSL to parse expression
Now DataSourceService#calculate use regexp and code logic for parse expression, if use ANTLR build dsl, maybe more suitable
Benefit:
1.Better performance with long expressions(Maybe)
2.Enable support for more flexible/complex expressions and function invoke at future
3.More security
Implement:
1.Complete the currently supported expression adaptation
2.Refer to promsql for more features
GitHub link: https://github.com/apache/hertzbeat/discussions/3205
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "bigcyy (via GitHub)" <gi...@apache.org>.
GitHub user bigcyy added a comment to the discussion: Use ANTLR DSL to parse expression
I will attempt to add expressions like `sql > 23 and xxx`, referring to the implementation in [https://github.com/oceanbase/miniob/blob/main/src/observer/sql/parser/yacc\_sql.y](https://github.com/oceanbase/miniob/blob/main/src/observer/sql/parser/yacc_sql.y).
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-13295280
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "tomsun28 (via GitHub)" <gi...@apache.org>.
GitHub user tomsun28 added a comment to the discussion: Use ANTLR DSL to parse expression
Another thing is that we have to consider whether it is appropriate to support queries in multiple languages, or just one.
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12868285
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "MasamiYui (via GitHub)" <gi...@apache.org>.
GitHub user MasamiYui added a comment to the discussion: Use ANTLR DSL to parse expression
sry, could you please describe it in more detail? I guess what you said QueryExecutor.execute supporting sql, and what i said before is replace regex + stack parse expression replace by antlr4, i am not sure which one you're talking about.
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12745341
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "MasamiYui (via GitHub)" <gi...@apache.org>.
GitHub user MasamiYui edited a discussion: Use ANTLR DSL to parse expression
Now DataSourceService#calculate use regexp and code logic for parse expression, if use ANTLR build dsl, maybe more suitable
Benefit:
1.Better performance with long expressions(Maybe)
2.Enable support for more flexible/complex expressions and function invoke at future
3.More security
Implement:
1.Complete the currently supported expression adaptation
2.Refer to promql for more features
GitHub link: https://github.com/apache/hertzbeat/discussions/3205
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "MasamiYui (via GitHub)" <gi...@apache.org>.
GitHub user MasamiYui added a comment to the discussion: Use ANTLR DSL to parse expression
> Collaborator
Thanks for your reply, I found that there is an empty implementation of SqlQueryExecutor in the code, i have two questions to ask:
1. When support sql query, the data source is still GreptimeDB or VictoriaMetrics? we need to convert the sql to promql?
2. Are there any other products with similar functions(support multiple language query)?
I don't know if anyone is doing this now, if not, I can try to make it.
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12865502
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org
Re: [D] Use ANTLR DSL to parse expression [hertzbeat]
Posted by "tomsun28 (via GitHub)" <gi...@apache.org>.
GitHub user tomsun28 added a comment to the discussion: Use ANTLR DSL to parse expression
> sry, could you please describe it in more detail? I guess what you said QueryExecutor.execute supporting sql, and what i said before is replace regex + stack parse expression replace by antlr4, i am not sure which one you're talking about.
hi sry for slow response, yes i said the implement of the `antlr4` instread of `regex+stack` maybe need consider the impact of support `QueryExecutor.execute supporting sql` in the future. Theory should have no effect
GitHub link: https://github.com/apache/hertzbeat/discussions/3205#discussioncomment-12856160
----
This is an automatically sent email for dev@hertzbeat.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@hertzbeat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hertzbeat.apache.org
For additional commands, e-mail: dev-help@hertzbeat.apache.org