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

Add decimal support for min(x,n), max(x,n) #9004

Closed
minhancao opened this issue Mar 7, 2024 · 1 comment
Closed

Add decimal support for min(x,n), max(x,n) #9004

minhancao opened this issue Mar 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@minhancao
Copy link
Contributor

minhancao commented Mar 7, 2024

Description

Add decimal support for min(x,n), max(x,n) functions.

Expected output:

presto:tpch> SELECT MIN(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0       
------------------
 [0.8200, 2.3330] 
(1 row)
presto:tpch> SELECT MIN(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0           
--------------------------
 [0.8200, 2.3330, 3.1320] 
(1 row)
presto:tpch> SELECT MAX(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0       
------------------
 [4.3440, 3.1320] 
(1 row)
presto:tpch> SELECT MAX(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0           
--------------------------
 [4.3440, 3.1320, 2.3330] 
(1 row)

@minhancao minhancao added the enhancement New feature or request label Mar 7, 2024
facebook-github-bot pushed a commit that referenced this issue Apr 25, 2024
Summary:
Delivers #9004

This PR is for adding decimal support for min() and max() functions.

presto-cli output:
```
presto:tpch> SELECT MIN(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0
------------------
 [0.8200, 2.3330]
(1 row)
presto:tpch> SELECT MIN(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0
--------------------------
 [0.8200, 2.3330, 3.1320]
(1 row)
presto:tpch> SELECT MAX(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0
------------------
 [4.3440, 3.1320]
(1 row)
presto:tpch> SELECT MAX(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0
--------------------------
 [4.3440, 3.1320, 2.3330]
(1 row)

```

Pull Request resolved: #9005

Reviewed By: pedroerp

Differential Revision: D56487562

Pulled By: Yuhta

fbshipit-source-id: 283eb189a91840835784e565cd33fa713167d17d
@minhancao
Copy link
Contributor Author

PR has been merged, closing issue

Joe-Abraham pushed a commit to Joe-Abraham/velox that referenced this issue Jun 7, 2024
…or#9005)

Summary:
Delivers facebookincubator#9004

This PR is for adding decimal support for min() and max() functions.

presto-cli output:
```
presto:tpch> SELECT MIN(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0
------------------
 [0.8200, 2.3330]
(1 row)
presto:tpch> SELECT MIN(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0
--------------------------
 [0.8200, 2.3330, 3.1320]
(1 row)
presto:tpch> SELECT MAX(Col,2) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
      _col0
------------------
 [4.3440, 3.1320]
(1 row)
presto:tpch> SELECT MAX(Col,3) FROM (VALUES cast(0.82 as decimal(5,4)), cast(2.333 as decimal(5,4)), cast(3.132 as decimal(5,4)), cast(4.344 as decimal(5,4))) AS X(Col);
          _col0
--------------------------
 [4.3440, 3.1320, 2.3330]
(1 row)

```

Pull Request resolved: facebookincubator#9005

Reviewed By: pedroerp

Differential Revision: D56487562

Pulled By: Yuhta

fbshipit-source-id: 283eb189a91840835784e565cd33fa713167d17d
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

1 participant