ike560 opened a new issue, #3922:
URL: https://github.com/apache/arrow-datafusion/issues/3922
**Describe the bug**
The following error occurs in cast of timestamp.
Exception: Internal error: Unsupported CAST from Timestamp(Microsecond,
None) to Int32. This was likely caused by a bug in DataFusion's code and we
would welcome that you file an bug report in our issue tracker
**To Reproduce**
```py
import datafusion
ctx = datafusion.SessionContext()
ctx.register_parquet('nyc_taxi', 'nyc_taxi.parquet')
sql = '''
WITH a AS
(SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
CAST(tpep_pickup_datetime AS INTEGER) AS pickup,
CAST(tpep_dropoff_datetime AS INTEGER) AS dropoff
FROM nyc_taxi)
SELECT
CAST(AVG(dropoff - pickup) AS NUMERIC(5, 2))
FROM a
'''
df = ctx.sql(sql)
df.show()
```
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Input In [5], in <module>
4 sql = '''
5 WITH a AS
6 (SELECT
(...)
14 FROM a
15 '''
16 df = ctx.sql(sql)
---> 17 df.show()
Exception: Internal error: Unsupported CAST from Timestamp(Microsecond,
None) to Int32. This was likely caused by a bug in DataFusion's code and we
would welcome that you file an bug report in our issue tracker
**Additional context**
Latest version : datafusion 0.6.0 (python)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]