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

change extract return types to decimal to align with postgres #3996

Open
Tracked by #8282 ...
waitingkuo opened this issue Oct 28, 2022 · 3 comments
Open
Tracked by #8282 ...

change extract return types to decimal to align with postgres #3996

waitingkuo opened this issue Oct 28, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@waitingkuo
Copy link
Contributor

extract currently returns i32 which might loss some information

select extract(second from timestamp '2000-01-01T00:00:00.1');
+--------------------------------------------------------+
| datepart(Utf8("SECOND"),Utf8("2000-01-01T00:00:00.1")) |
+--------------------------------------------------------+
| 0                                                      |
+--------------------------------------------------------+
1 row in set. Query took 0.000 seconds.

while postgresql returns decimal

willy=# select extract(second from timestamp '2000-01-01T00:00:00.1');
 extract  
----------
 0.100000
(1 row)

Describe the solution you'd like
A clear and concise description of what you want to happen.

change it to decimal

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@tustvold
Copy link
Contributor

This likely will want to wait until decimal support is more consistent - see #4036

@comphead
Copy link
Contributor

comphead commented Dec 6, 2022

@waitingkuo looks like #4385 will address this ticket? Tests return seconds as floats

@waitingkuo
Copy link
Contributor Author

@comphead this is to align with postgresql to output decimal instead of decimal which could prevent something like this

select date_part('millisecond', timestamp '2000-01-01T00:00:09.123456');
+------------------------------------------------------------------+
| datepart(Utf8("millisecond"),Utf8("2000-01-01T00:00:09.123456")) |
+------------------------------------------------------------------+
| 9123.455999999998                                                |
+------------------------------------------------------------------+
1 row in set. Query took 0.002 seconds.

note that this datafusion-cli is from the date_part_f64 branch

@alamb alamb changed the title change extract return types to decimal change extract return types to decimal to align with postgres Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants