raintank / crate-datasource

Apache License 2.0
13 stars 8 forks source link

timeFilter is not quoted and therefor doesn't support CamelCaseTimestamp columns #40

Closed jodok closed 7 years ago

jodok commented 7 years ago
"SELECT floor(Timestamp/1000)*1000 as time, count(*) FROM \"mytable\".\"raw\" WHERE Timestamp >= '1489947303696' and Timestamp <= '1489948069508' GROUP BY time ORDER BY time ASC"

i tried to fix it here: https://github.com/crate/crate-datasource/tree/jb/quoteColumn but this creates an invalid SQL statement.

"SELECT floor(\"timestamp\"/5000)*5000 as time, avg(fields['usage_system']) AS \"usage_system\", tags['cpu'] FROM \"telegraf\".\"measurement\" WHERE '\"timestamp\" >= 1489926360440 AND \"timestamp\" <= 1489934237364' AND tags['host'] in ('0730c27be041', '5bde214eda76', '8f57e6d8bc9e', 'ed6d018c4f83') AND name = 'cpu' GROUP BY time, tags['cpu'] ORDER BY time, tags['cpu'] ASC"

it seems that that is using formatCrateValue to properly quote values - and is also quoting the entire timeFilter which is already properly quoted.