https://questdb.io logo
Title
f

Franco Almonacid

03/08/2023, 9:14 PM
Hi again guys! We are having a strange issue while running this query:
select timestamp,
  NULL as trade, log(sum(size)) as trade_size
  from 'binance_agg_trades_rt' WHERE symbol='ETHUSDT' AND timestamp > timestamp_floor('m',dateadd('s', -20, now())) SAMPLE BY 1s FILL(PREV)
as soon as we run that query the web console shows the error
QuestDB is not reachable [502]
, and the logs show this:
2023-03-08T21:10:04.391409Z I i.q.c.h.p.JsonQueryProcessorState [217] exec [q='select timestamp,
  NULL as trade, log(sum(size)) as trade_size
  from 'binance_agg_trades_rt' WHERE symbol='ETHUSDT' AND timestamp > timestamp_floor('m',dateadd('s', -20, now())) SAMPLE BY 1s FILL(PREV)
']
2023-03-08T21:10:04.391421Z I i.q.c.h.p.QueryCache miss [thread=questdb-http-6, sql=select timestamp,
  NULL as trade, log(sum(size)) as trade_size
  from 'binance_agg_trades_rt' WHERE symbol='ETHUSDT' AND timestamp > timestamp_floor('m',dateadd('s', -20, now())) SAMPLE BY 1s FILL(PREV)
]
2023-03-08T21:10:04.391616Z C i.q.c.h.p.JsonQueryProcessorState [217] Uh-oh. Error!
java.lang.NullPointerException

2023-03-08T21:10:04.391638Z I i.q.c.h.HttpConnectionContext kicked out [fd=217]
2023-03-08T21:10:04.391642Z I http-server scheduling disconnect [fd=217, reason=5]
then if I remove the
NULL as trade
part like this:
select timestamp,
  log(sum(size)) as trade_size
  from 'binance_agg_trades_rt' WHERE symbol='ETHUSDT' AND timestamp > timestamp_floor('m',dateadd('s', -20, now())) SAMPLE BY 1s FILL(PREV)
the query works just fine, any ideas?
b

Bolek Ziobrowski

03/08/2023, 10:43 PM
Could you please share table schema ? Doesn't the log contain exception with stack trace ?
I tried the following against latest master branch but didn't get any error :
create table binance_agg_trades_rt
(
  timestamp timestamp,
  size long, 
  symbol symbol
) timestamp(timestamp) partition by day;


  insert into binance_agg_trades_rt
  select dateadd('s', -x::int, now() ) , rnd_long(),  rnd_symbol('ETHUSDT', 'ETHBTC' )
  from long_sequence(100000);

select timestamp,
  NULL as trade, log(sum(size)) as trade_size
  from 'binance_agg_trades_rt' 
  WHERE symbol='ETHUSDT' 
  AND timestamp > timestamp_floor('m',dateadd('s', -20, now())) 
  SAMPLE BY 1s FILL(PREV)
What version do you use ?
f

Franco Almonacid

03/09/2023, 12:41 PM
Hi @Bolek Ziobrowski! Here is the schema:
CREATE TABLE binance_agg_trades_rt(
    id long,
    first_trade_id long,
    last_trade_id long,
    symbol SYMBOL index capacity 128,
    size DOUBLE,
    price DOUBLE,
    event_timestamp TIMESTAMP,
    timestamp TIMESTAMP
) timestamp(timestamp) PARTITION BY DAY
btw we are using version
6.6.1
b

Bolek Ziobrowski

03/09/2023, 12:48 PM
I still can't reproduce on latest so I think a version upgrade would be in order 🙂
f

Franco Almonacid

03/10/2023, 3:45 PM
Hi @Bolek Ziobrowski, I've just got the same error again but this time on a completely different query
2023-03-10T15:42:58.793267Z I i.q.c.h.p.QueryCache miss [thread=questdb-http-6, sql=select
2023-03-10T15:42:58.793715Z C i.q.c.h.p.JsonQueryProcessorState [665] Uh-oh. Error!
java.lang.NullPointerException
so your suggestion is to upgrade QuestDB, right?
b

Bolek Ziobrowski

03/10/2023, 3:50 PM
Yes. It'd be good to set
-XX:-OmitStackTraceInFastThrow
jdk flags to see actual stack traces and look up matching issues in GH .