Matt-Texier opened a new issue #9955:
URL: https://github.com/apache/incubator-superset/issues/9955


   Hi,
   
   When using custom time range and entering two dates within the same day, the 
query generated always gives an empty result as it generates a query with >= 
start_day and < star_day. As the second term is strict (exclusive) and that 
data is indexed on a per day basis, it excludes all data to be selected.
   
   ### Expected results
   
   I would expect to see data matching the date time beginning and end.
   
   ### Actual results
   
   The query generated exclude all data.
   
   #### Screenshots
   
   <img width="289" alt="Screenshot 2020-05-31 at 11 08 55" 
src="https://user-images.githubusercontent.com/11010314/83348729-63b7c600-a32f-11ea-9007-fc0054e021db.png";>
   
   
   generate query:
   
   ```sql
   SELECT ip_proto AS ip_proto,
          rtr_name AS rtr_name,
          port_dst AS port_dst,
          if_out_name AS if_out_name,
          port_src AS port_src,
          toStartOfMinute(toDateTime(full_time_stamp)) AS __timestamp,
          sum(packets)/any(bin_cycle_sec) AS pps
   FROM enriched_flows
   WHERE index_tstamp >= toDate('2020-05-30')
     AND index_tstamp < toDate('2020-05-30')
     AND full_time_stamp >= toDateTime('2020-05-30 22:00:00')
     AND full_time_stamp < toDateTime('2020-05-30 23:00:00')
     AND ipv4_dst = '134.90.137.11'
   GROUP BY ip_proto,
            rtr_name,
            port_dst,
            if_out_name,
            port_src,
            toStartOfMinute(toDateTime(full_time_stamp))
   ORDER BY pps DESC
   LIMIT 50000;
   <img width="289" alt="Screenshot 2020-05-31 at 11 08 55" 
src="https://user-images.githubusercontent.com/11010314/83348718-4682f780-a32f-11ea-961d-daa531ba70d4.png";>
   
   ```
   
   #### How to reproduce the bug
   
   1. Create a chart with customer time range, pick to date / time within he 
same day but with few hours difference
   2. Run the query
   3. On te to right burger icon, click view query
   4. You will see that superset include the time index as start but exclude 
the same time index of the current day (my db is using time index of day 
granularity and time stamp bin cycle of minute) 
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `0.36.0`
   - python version: `3.6.9`
   - node.js version: `v8.15.0`
   - npm version: `6.4.1`
   
   ### Checklist
   
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [x ] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x ] I have reproduced the issue with at least the latest released version 
of superset.
   - [x ] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   I don't know how the inclusive / exclusive logic has been designed, it could 
be that there is a corner case when user picks two dates time within the same 
day ... or missed something on how to use it... 
   
   Thanks for your help,
   Matt.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to