Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withRangeStats not recognizing Timestamp field #397

Open
justinkolpak-databricks opened this issue Apr 15, 2024 · 2 comments · Fixed by #400
Open

withRangeStats not recognizing Timestamp field #397

justinkolpak-databricks opened this issue Apr 15, 2024 · 2 comments · Fixed by #400
Assignees
Labels
bug Something isn't working

Comments

@justinkolpak-databricks

Issue: When a Timestamp column is specified as the ts_col for a tsdf, it does not get accurately interpreted as a Timestamp field in the logic that handles rangeBackWindowSecs.

Root Cause: In tsdf.py, def withRangeStats(), the following code never evaluates to True because the str representation of the dataType is TimestampType(), while the code expects TimestampType. The line causing the error is 1105:
if str(self.df.schema[self.ts_col].dataType) == "TimestampType":

Setup:
tsdf = tempo.TSDF(df, ts_col='<timestamp_column>')
tsdf_2 = tsdf.withRangeStats("SIDE", rangeBackWindowSecs=300).df

Error:
Cannot resolve "(PARTITION BY <partition_col> ORDER BY DATE_TIME ASC NULLS FIRST RANGE BETWEEN -300 FOLLOWING AND CURRENT ROW)" due to data type mismatch: The data type "TIMESTAMP" used in the order specification does not match the data type "BIGINT" which is used in the range frame. SQLSTATE: 42K09;

@tnixon tnixon self-assigned this Apr 15, 2024
@tnixon tnixon added the bug Something isn't working label Apr 15, 2024
@tnixon
Copy link
Contributor

tnixon commented Apr 15, 2024

How very annoying! This is definitely not the right way to test the dataType anyway. I'll see about updating this ASAP!

@justinkolpak-databricks
Copy link
Author

Thanks!

@tnixon tnixon linked a pull request May 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants