-
Notifications
You must be signed in to change notification settings - Fork 279
[feature]: support comparison binary operations #912
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
Comments
Hi there! I'd like to work on this issue. 🚀Let's make this happen! 💪 Please forgive me for not fully understanding the meaning of this issue. What I can think of is that you hope that lindb can support the following SQL statement query:
Can you tell me whether my understanding is correct? If not, please describe this issue in more detail. Thank you. |
✌️ , Welcome to contribute LinDB together. Yes, you are right. Some cases like this: select x, y, z from a>10.1; // fields
select x+y as a, 2*z, z from a>10 and 2*z>10; // expr
select sum(x) as a from a>10; // function |
select sum(x) as a from a>10; // function
=>
select sum(x) as a from metric_x having a > 10; |
If I make any mistakes, please feel free to interrupt me. Filtering for fields can only be done at the root node of the broker because it requires aggregating results from all intermediate nodes or storage nodes in the broker. Only when all families from all shards are aggregated by interval can the data that doesn't meet the WHERE conditions be filtered out. Implementing this feature in root_metric_context.go might be the most suitable approach. For queries involving GROUP BY time in standard SQL, field filtering should occur before grouping. In other words, fields that do not meet the conditions should not be included in the group calculation. However, for Lindb, filtering of fields should occur after grouping. In this case, filtering fields behaves similarly to the HAVING clause. Therefore, if Lindb supports HAVING queries, the following two SQL statements would be equivalent. select * from a where field_a = 1 group by time(1m); // Assuming this is valid.
select * from a group by time(1m) having field_a = 1; The field condition may not necessarily appear in the selectExpr, which also determines some modifications in certain operators. |
I made a mistake.
Let's implement scenario 2 first, and at the same time, like standard SQL, the field condition must appera in the selectExpr? |
Yes, grouping field filtering only be done in the root node before building result set. |
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: