date_trunc function when connect to hive
See original GitHub issueMake sure these boxes are checked before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Superset version
0.28.1
Expected results
Actual results
errorCode=10011, errorMessage="Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 6:9 Invalid function 'date_trunc'"), operationHandle=None)
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/superset/connectors/sqla/models.py", line 783, in query
df = self.database.get_df(sql, self.schema)
File "/usr/lib/python3.6/site-packages/superset/models/core.py", line 789, in get_df
self.db_engine_spec.execute(cursor, sqls[-1])
File "/usr/lib/python3.6/site-packages/superset/db_engine_specs.py", line 1268, in execute
cursor.execute(query, **kwargs)
File "/usr/lib/python3.6/site-packages/pyhive/hive.py", line 365, in execute
_check_status(response)
File "/usr/lib/python3.6/site-packages/pyhive/hive.py", line 495, in _check_status
raise OperationalError(response)
Steps to reproduce
When I create time series bar chart, Superset uses ‘date_trunc’ function in hiveql group by clause and it raise exception.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
date_trunc function when connect to hive · Issue #7270 - GitHub
When I create time series bar chart, Superset uses 'date_trunc' function in hiveql group by clause and it raise exception.
Read more >date_trunc in hive is working incorrectly - Stack Overflow
I am running below query: select a.event_date, date_format(date_trunc('month', a.
Read more >Equivalent function of trunc(month_date,q) in HiveQL
Hi, I have a table in Hadoop stores data monthwise , eg. ... or method in hive. Please help ! tried date_trunc, but...
Read more >Hive Date and Timestamp Functions | Examples
Hive Date and Timestamp functions are used to manipulate Date and Time on HiveQL queries over Hive CLI, Beeline, and many more applications...
Read more >date_trunc function | Databricks on AWS
Learn the syntax of the date_trunc function of the SQL language in Databricks SQL and Databricks Runtime.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same here. I’ve checked the source code in incubator-superset/superset/db_engine_specs.py, from what I’m seeing, the reason this error happened is because they’re using PrestoEngineSpec as HiveEngineSpec, as the code below:
and hive doesn’t support ‘date_trunc’ method. So if u can build from the source code, u can just change the code into some thing like this:
this should do the work.
Remember you can override time grain functions in
superset_config.py
(see examples) without having to edit source and rebuild!