-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add integration tests for charindex, dateadd, to_timestamp (DNA-19468 / DNA-20817) #84
Conversation
ef7adf5
to
d93ace3
Compare
{{ pm_utils.charindex('is', '`Text`') }} as `Find_first_of_multiple_occurrences`, | ||
3 as `Find_first_of_multiple_occurrences_expected`, | ||
|
||
{# Find a space. SQL Server handles spaces differently #} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that SQL Server handles spaces differently, but that's applicable for the len
function, not the charindex
function. Maybe rephrase this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the comment to cover it better
{{ pm_utils.to_varchar(pm_utils.dateadd('year', 1, '`testdate`')) }} as `add_years`, | ||
|
||
{# Use bigint as the value #} | ||
{{ pm_utils.to_varchar(pm_utils.dateadd('year', '`bigint_value`', '`testdate`')) }} as `add_bigint`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No test for this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the testcase here
with Input_data as ( | ||
select | ||
'2023-11-12 13:14:15.678' as `testdate`, | ||
null as `null_value`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a datetime NULL
value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically you are correct. We just removed the test for type tests from pm_utils. We can add it in the test and add Databricks support, but it is not compatible with Spark (no information_schema available). We discussed it and for now we will leave it this way, we will add a test if we run into an issue here.
|
||
{# Use null as the date #} | ||
{{ pm_utils.to_varchar(pm_utils.dateadd('year', 1, '`null_value`')) }} as `add_to_null_value`, | ||
'' as `add_to_null_value_expected` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then this should also be a NULL
datetime/date? 🤔
'2023-11-12 13:14:15.678' as `timestamp_datetime_ms`, | ||
'2023-11-12 13:14:15.6789' as `timestamp_datetime_ms4`, | ||
'13:14:15' as `timestamp_time`, | ||
null as `null_value` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before, shouldn't it be a datetime NULL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comments, also check why dbt deps
recursively creates folders indefinitely.
d93ace3
to
35e6ec3
Compare
Description
charindex
,dateadd
andto_timestamp
macro'sRelease
main
)dev
(or other) branchDid you consider?
- [ ] What is the performance impact?- [ ] The version number indbt_project.yml