Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
Sandeep Kumawat committed Oct 10, 2023
1 parent faffe7a commit 0e53823
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/JDBC/expected/BABEL-3953-datetrunc-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ datetime2

~~ERROR (Message: 'NULL' is not a recognized datetrunc option.)~~

select datetrunc('year',CAST('2020-01-01' as date))
go
~~START~~
date
2020-01-01
~~END~~

select datetrunc(year, null) as dt3
GO
~~START~~
Expand Down Expand Up @@ -241,6 +248,18 @@ numeric
~~ERROR (Message: Argument data type 'numeric' is invalid for argument 2 of datetrunc function.)~~


-- postgres support 6 digits of fractional time-scale so the bbf output will differ
-- in the last fractional second digit from t-sql. bbf- 2021-12-08 11:30:15.1234570
-- tsql- 2021-12-08 11:30:15.1234560
DECLARE @d datetime2 = '2021-12-08 11:30:15.1234567';
SELECT 'Microsecond', DATETRUNC(microsecond, @d);
Go
~~START~~
varchar#!#datetime2
Microsecond#!#2021-12-08 11:30:15.1234570
~~END~~


DECLARE @test_date date;
SET @test_date = '1998-09-12';
SELECT datetrunc(week, @test_date);
Expand Down
9 changes: 9 additions & 0 deletions test/JDBC/input/functions/BABEL-3953-datetrunc-vu-verify.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ select datetrunc('NULL', null) as dt1
GO
select datetrunc('NULL', 'NULL') as dt1
GO
select datetrunc('year',CAST('2020-01-01' as date))
go
select datetrunc(year, null) as dt3
GO
select datetrunc(years, null) as dt4
Expand All @@ -81,6 +83,13 @@ GO
select datetrunc(hour, 2020.0)
GO

-- postgres support 6 digits of fractional time-scale so the bbf output will differ
-- in the last fractional second digit from t-sql. bbf- 2021-12-08 11:30:15.1234570
-- tsql- 2021-12-08 11:30:15.1234560
DECLARE @d datetime2 = '2021-12-08 11:30:15.1234567';
SELECT 'Microsecond', DATETRUNC(microsecond, @d);
Go

DECLARE @test_date date;
SET @test_date = '1998-09-12';
SELECT datetrunc(week, @test_date);
Expand Down

0 comments on commit 0e53823

Please sign in to comment.