parseable icon indicating copy to clipboard operation
parseable copied to clipboard

Error when trying to use the DATE_BIN function

Open stanvanrooy opened this issue 1 year ago • 7 comments

This query:

SELECT COUNT(*) as successful_logins, DATE_BIN('15 minutes', p_timestamp) as time 
FROM backend
GROUP BY time

Gives me the following error message:

Query execution failed due to Query Execution failed due to error in datafusion: push_down_projection caused by Internal error: Optimizer rule 'push_down_projection' 
failed, due to generate a different schema, 

original schema: DFSchema { fields: [DFField { qualifier: None, field: Field { name: "successful_logins", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, DFField { qualifier: None, field: Field { name: "time", data_type: Timestamp(Millisecond, None), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }], metadata: {} }, 

new schema: DFSchema      { fields: [DFField { qualifier: None, field: Field { name: "successful_logins", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, DFField { qualifier: None, field: Field { name: "time", data_type: Timestamp(Nanosecond, None), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }], metadata: {} }. 

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

It seems like the timestamp changes precision from ms to ns. I'm not sure if I should file this bug with you guys or directly with Datafusion.

stanvanrooy avatar Dec 22 '23 07:12 stanvanrooy

cc @trueleo

nitisht avatar Dec 22 '23 07:12 nitisht

We'll take a look shortly @stanvanrooy

nitisht avatar Dec 22 '23 07:12 nitisht

@stanvanrooy Can you tell us which version of parseable you are running.

trueleo avatar Dec 22 '23 07:12 trueleo

@trueleo, I'm still on an older version: v0.6.2

stanvanrooy avatar Dec 22 '23 10:12 stanvanrooy

@trueleo I don't want to be pushy, but is there any update? Is there a work-around? Or is this already fixed in a newer version? DATE_BIN is super useful, so it is a shame it can't be used right now.

stanvanrooy avatar Mar 04 '24 12:03 stanvanrooy

We'll take a look soon @stanvanrooy

nitisht avatar Mar 04 '24 16:03 nitisht

@stanvanrooy can you try the latest release? Seems like query is working Here is the datafusion docs on date_bin https://arrow.apache.org/datafusion/user-guide/sql/scalar_functions.html#date-bin

nitisht avatar Mar 06 '24 06:03 nitisht

Closing for now, assuming it works for you @stanvanrooy . Feel free to reopen if there are issues.

nitisht avatar Apr 12 '24 09:04 nitisht