Skip to content

Internal error in CAST from Timestamp[us] #3922

@ghost

Description

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions