Hello!
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.

This query example
SELECT CAST(varchar_timestamp_field AS TIMESTAMP) AS timestamps, value
FROM table
Results on

To explore the data and to create a chart, click on explore values:
Make sure these boxes are checked before submitting your issue - thank you!
Looking to the fix on #7657, at 7 of June 2019, a new class was created on file db_engine_specs.py (on that version):
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 file db_engine_specs, and the function above was not included, am I right?
Thanks!
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, dashboard and code for this bot.
I have identified the issue and have started working on the same
@nielsenrechia Pull request created: https://github.com/apache/incubator-superset/pull/10084
It looks like it may have been a merge conflict (refactor vs fix). 馃憖 at the PR now