You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/06/02 17:32:37 UTC

[GitHub] [incubator-superset] nielsenrechia opened a new issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch commented on issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967#issuecomment-645424895


   It looks like it may have been a merge conflict (refactor vs fix). 👀 at the PR now


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] Nj-kol commented on issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

Posted by GitBox <gi...@apache.org>.
Nj-kol commented on issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967#issuecomment-645279307


   I have identified the issue and have started working on the same


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] issue-label-bot[bot] commented on issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

Posted by GitBox <gi...@apache.org>.
issue-label-bot[bot] commented on issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967#issuecomment-637698184


   Issue-Label Bot is automatically applying the label `#bug` to this issue, with a confidence of 0.94. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback! 
   
    Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/apache/incubator-superset) and [code](https://github.com/hamelsmu/MLapp) for this bot.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] Nj-kol commented on issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

Posted by GitBox <gi...@apache.org>.
Nj-kol commented on issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967#issuecomment-645340935


   @nielsenrechia  Pull request created: https://github.com/apache/incubator-superset/pull/10084


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] villebro closed issue #9967: invalid function date_trunc when connecting to hive -- related to issue #7270

Posted by GitBox <gi...@apache.org>.
villebro closed issue #9967:
URL: https://github.com/apache/incubator-superset/issues/9967


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org