Search code examples
javainfluxdbgrafana

InfluxDB "Couldn't look up columns" when a WHERE clause on time is used


Using the Java client, I'll insert a series like this:

Serie serie1 =
    new Serie.Builder(perfStat.pointCut).columns("time", "value").values(perfStat.start, perfStat.end - perfStat.start).build();
influxDB.write("pointcut_performance", TimeUnit.MICROSECONDS, serie1);

Grafana tries to run this query, which fails... It also fails in the influxdb admin tool:

select mean(value) from "com.xxx.databunker.salesforce.processing.jms.SalesForceLeadMessageListener.onMessage(Message)" where time > now() - 6h group by time(1s) order asc

You get this error: ERROR: Couldn't look up columns. If you take out the "where" clause, it runs:

select value from "com.springventuregroup.databunker.salesforce.processing.jms.SalesForceLeadMessageListener.onMessage(Message)" 

I can't find this in the documentation. Any help much appreciated!

EDIT

The problem is: there is obviously data in the database that is query-able, as long as your query doesn't have a where close. Why am I getting that error?


Solution

  • I had the exact same issue, after several tests I found out that the problem was how I was sending the time column,

    If I had this data:

    1326219450000   132850001   request     http://yahoo.com    1
    1326219449000   132840001   response    http://tranco.com   1
    

    then the error was thrown only when I added this part "where time > now() - 1d", I could add another where clause but not that one, after dividing by 1000 the time I was sending no more errors.

    1412218778912   132830001   response    http://google.com   1
    1412218778720   132820001   request     http://cranka.com   1
    

    now If I leave both sets:

    1412133515000   132870001   request     http://penca.com    1
    1412133515000   132860001   request     http://cranka.com   1
    1326219450000   132850001   request     http://yahoo.com    1
    1326219449000   132840001   response    http://tranco.com   1
    

    I can do the query just fine and grafana works again

    select * from requests where time > now() - 1d
    

    here is a comment about influx taking time in seconds instead of milliseconds, https://github.com/influxdb/influxdb/issues/572