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

fsql "SELECT * from . WHERE size > 1gb" doesn't work #29

Open
christiangenco opened this issue Jun 10, 2017 · 4 comments
Open

fsql "SELECT * from . WHERE size > 1gb" doesn't work #29

christiangenco opened this issue Jun 10, 2017 · 4 comments
Labels

Comments

@christiangenco
Copy link

If I run a query like in the README gif it works:

$ fsql "SELECT * from . WHERE name LIKE mkv AND size > 1gb"
...lots of results

but taking away the name LIKE mkv clause breaks it:

$ fsql "SELECT * from . WHERE size > 1gb"
2017/06/09 22:52:28 strconv.ParseFloat: parsing "1gb": invalid syntax
@kashav
Copy link
Owner

kashav commented Jun 10, 2017

Hey @christiangenco, thanks for the issue!

That syntax for size units was actually removed as of v0.2.0 (haven't gotten around to updating the GIF yet).

What you're actually looking for is:

$ fsql "SELECT * FROM . WHERE FORMAT(size, GB) > 1"

I think you found an interesting bug, but I can't seem to reproduce it (the first query errors out for me, as it should). Can you run the following and see what's outputted?

$ fsql "SELECT * FROM . WHERE size > 1gb AND name LIKE mkv"

Also, does the output of the first query include any results where the size is less than 1 gigabyte?

@kashav kashav added the bug label Jun 10, 2017
@christiangenco
Copy link
Author

$ fsql "SELECT * FROM . WHERE size > 1gb AND name LIKE mkv"
2017/06/14 14:44:37 strconv.ParseFloat: parsing "1gb": invalid syntax

FORMAT(size, GB) > 1 feels way grosser than size > 1gb - was there a technical reason for the change?

@kashav
Copy link
Owner

kashav commented Jun 18, 2017

Sorry for the late response, been a little busy with school.

I do agree that the new syntax is not as clean/intuitive. The main reasoning behind this was to be more consistent between attribute modifiers (both in implementation and syntax).

Parsing the unit from the value itself required special consideration in the tokenizer, which I'd prefer to avoid. That being said, I'm all for re-adding that syntax if it could be implemented with the current modifier model (I'll definitely look into this!).

@christiangenco
Copy link
Author

Check out how Crab does it:

select f1.bytes/1e6 as MB from files...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants