added avail gap fix and empty span insert into sql tsdb
fixed sql tsdb query