nielsenrechia opened a new issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967


   A year ago @iannamkr open a issue  #7270 on version 0.28.0 that was fixed on 
 #7657.
   
   Whatever, the error is still happening on version 0.36.0 
   
   The problem is when I try to create a time-series line chart. So, Superset 
uses 'date_trunc' function in hivesql group by clause and it raises an 
exception.
   
   
![image](https://user-images.githubusercontent.com/679126/83550297-02cdf080-a4dd-11ea-966a-eb55f60dfe71.png)
   
   ### Actual results and How to reproduce the bug
   
   This query example
   ```
   SELECT CAST(varchar_timestamp_field AS TIMESTAMP) AS datetime, value
   FROM table
   ```
   Results on 
   
   
![image](https://user-images.githubusercontent.com/679126/83542044-d3b18200-a4d0-11ea-814d-73c216d1cb60.png)
   
   To explore the data and to create a chart, click on explore values:
   1. So, select the Line chart style
   2. After, select the timestamp as a timestamp column
   3. So, set the time grain to hours. 
   4. Then, set the value as a metric with SUM aggregation function. 
   
   ### 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
   
   Looking the fix on #7657 at 7 of June 2019 on file db_engine_specs.py (on 
that version) was created 
   
   ```
   class HiveEngineSpec(BaseEngineSpec):
   
       """Reuses PrestoEngineSpec functionality."""
       
       engine = 'hive'
       max_column_name_length = 767
       
       time_grain_functions = {
           None: '{col}',
           'PT1S': "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd 
HH:mm:ss')",
           'PT1M': "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd 
HH:mm:00')",
           'PT1H': "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd 
HH:00:00')",
           'P1D': "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd 00:00:00')",
           'P1W': "date_format(date_sub(nianxian, 
CAST(7-from_unixtime(unix_timestamp(nianxian),'u') as int)), 'yyyy-MM-dd 
00:00:00')",
           'P1M': "from_unixtime(unix_timestamp({col}), 'yyyy-MM-01 00:00:00')",
           'P0.25Y': "date_format(add_months(trunc(nianxian, 'MM'), 
-(month(nianxian)-1)%3), 'yyyy-MM-dd 00:00:00')",
           'P1Y': "from_unixtime(unix_timestamp({col}), 'yyyy-01-01 00:00:00')",
           'P1W/1970-01-03T00:00:00Z': "date_format(date_add(nianxian, 
INT(6-from_unixtime(unix_timestamp(nianxian), 'u'))), 'yyyy-MM-dd 00:00:00')",
           '1969-12-28T00:00:00Z/P1W': "date_format(date_add(nianxian, 
-INT(from_unixtime(unix_timestamp(nianxian), 'u'))), 'yyyy-MM-dd 00:00:00')"
       }
   ```
   But, on new commit at 8 of June of the same year  
(https://github.com/apache/incubator-superset/commit/95291facff5c49ce4c63da25ff3efaf4bf101822)
 was broken up the db_engine_specs and the function above was not included, am 
I right?
   
   Thanks!
   
   


----------------------------------------------------------------
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