Skip to content
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

Using arithmetic operators when joining isn't working #86

Closed
hvt opened this issue Dec 2, 2013 · 3 comments
Closed

Using arithmetic operators when joining isn't working #86

hvt opened this issue Dec 2, 2013 · 3 comments

Comments

@hvt
Copy link

hvt commented Dec 2, 2013

The following query:

select appa.bytes + appb.bytes 
from test as appa 
inner join test as appb 
where appa.app == 'ssl' and appb.app == 'web-browsing'

Results in:

Error at 12473601:18. syntax error, unexpected '+', expecting FROM

Running 0.3.0 on amd64 (Linux Mint).

@jvshahid
Copy link
Contributor

jvshahid commented Dec 2, 2013

I updated the title to match what i think is the problem

@jvshahid
Copy link
Contributor

jvshahid commented Dec 4, 2013

I pushed a change to support arithmetic expressions in select queries. That said, the query above won't work as expected since the where clause takes effect after the two time series are joined. Since joining is done based on timestamps, the joined time series will have the same points merged together, i.e. appa.app will always equal appb.app. As a matter of fact, appa.<any column> will equal appb.<any column>. This means that the condition in your where clause will always evaluate to false. The only way to achieve what you're trying to do, is using subqueries which i'll work on next #52. After subqueries is implemented, the correct query should be:

select appa.bytes + appb.bytes
from (select bytes from test where app = 'ssl') as appa
inner join (select bytes from test where app = 'web-browsing') as appb

I hope my explanation makes sense. Please let me know if you have any questions.

@jvshahid
Copy link
Contributor

jvshahid commented Dec 4, 2013

Closed by 0bff817

@jvshahid jvshahid closed this as completed Dec 4, 2013
jvshahid pushed a commit that referenced this issue Aug 12, 2014
change join command to interface, so application can overwrite it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants