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

Decimal(a,b) cast to Decimal(b,c) is forbidden #2135

Closed
EmmyMiao87 opened this issue Nov 5, 2019 · 2 comments
Closed

Decimal(a,b) cast to Decimal(b,c) is forbidden #2135

EmmyMiao87 opened this issue Nov 5, 2019 · 2 comments
Assignees
Labels
area/sql/compatibility Issues or PRs related to the SQL compatibililty need more test Add more test
Milestone

Comments

@EmmyMiao87
Copy link
Contributor

EmmyMiao87 commented Nov 5, 2019

Describe the bug
mysql> select cast(k5 as decimal(15,4)) from baseall;
ERROR 1064 (HY000): Invalid type cast of k5 from DECIMAL(9,0) to DECIMAL(15,4)

To Reproduce
Steps to reproduce the behavior:
1.

CREATE TABLE `baseall` (
  `k1` tinyint(4) NOT NULL COMMENT "",
  `k2` smallint(6) NOT NULL COMMENT "",
  `k3` int(11) NOT NULL COMMENT "",
  `k4` bigint(20) NOT NULL COMMENT "",
  `k5` decimal(9, 3) NOT NULL COMMENT "",
  `k6` char(5) NOT NULL COMMENT "",
  `k10` date NOT NULL COMMENT "",
  `k11` datetime NOT NULL COMMENT "",
  `k7` varchar(20) NOT NULL COMMENT "",
  `k8` double MAX NOT NULL COMMENT "",
  `k9` float SUM NOT NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k10`, `k11`, `k7`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`k1`) BUCKETS 5
PROPERTIES (
"storage_type" = "COLUMN"
);
  1. mysql> select cast(k5 as decimal(15,4)) from baseall;

Expected behavior
return the value of k5 in baseall;

The tpc-ds query 18,61 are the same error as above.

@EmmyMiao87
Copy link
Contributor Author

In fact, Doris does not check the precision of decimal in query. So the precision and scale in decimalV2 is useless during query.

@EmmyMiao87 EmmyMiao87 added the area/sql/compatibility Issues or PRs related to the SQL compatibililty label Nov 5, 2019
@EmmyMiao87 EmmyMiao87 self-assigned this Nov 5, 2019
@EmmyMiao87 EmmyMiao87 added this to the 0.12.0 milestone Nov 5, 2019
@EmmyMiao87
Copy link
Contributor Author

#2131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sql/compatibility Issues or PRs related to the SQL compatibililty need more test Add more test
Projects
None yet
Development

No branches or pull requests

1 participant