You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Given
Bigquery adapter,
source with numeric value for timestamp (values are in timestamp_seconds eg. '1111930985') lets say, column "TS",
model to be generated has Timestamp as datatype for column "TS"
Then
While writing unit test in yaml format, the values for TS are converted as safe_cast('''1111930985''' as TIMESTAMP)
this results in null if quotes are added in Test data,
for int value error generated as cannot convert INT64 to TIMESTAMP
Expected Behavior
For time stamp values with Bigquery
TIMESTAMP_SECONDS should be used for converting numeric data
and use PARSE_TIMESTAMP("%S",'') for String data
Steps To Reproduce
choose bigquery adapter(1.8.4)
create table TS_TEST in dataset having column TS with datatype as String
populate TS_TEST with epoch data for timestamps
create incremental Model TS_Test_new, this should read from TS_TEST & store TS in timestamp datatype
write unit test using Yaml format, provide input & expected values in terms of epoch data for TS
dbt test should fail, even if model query is correct. because while generating actual and expected results, parsing of timestamps fails.
Relevant log output
Case1: String value for TS
actual differs from expected:
@@, col1, col2, TS
---,1 ,2 , null
Case2: Numeric value for TS
Database Error
Invalid cast from INT64 to TIMESTAMP at [60:128]
amychen1776
changed the title
Unit Testing with bigquery adapter "expected" values for timestamp returns null
[BUG] Unit Testing with bigquery adapter "expected" values for timestamp returns null
Aug 28, 2024
Is this a new bug?
Current Behavior
Given
Bigquery adapter,
source with numeric value for timestamp (values are in timestamp_seconds eg. '1111930985') lets say, column "TS",
model to be generated has Timestamp as datatype for column "TS"
Then
While writing unit test in yaml format, the values for TS are converted as safe_cast('''1111930985''' as TIMESTAMP)
this results in null if quotes are added in Test data,
for int value error generated as cannot convert INT64 to TIMESTAMP
Expected Behavior
For time stamp values with Bigquery
TIMESTAMP_SECONDS should be used for converting numeric data
and use PARSE_TIMESTAMP("%S",'') for String data
Steps To Reproduce
Relevant log output
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: