[
https://issues.apache.org/jira/browse/CALCITE-6909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu updated CALCITE-6909:
---------------------------
Description:
Currently ClickHouse Dailect can not support accurate precision
In ClickHouse:
* *P - precision. Valid range: [ 1 : 76 ].*
* *S - scale. Valid range: [ 0 : P ].*
Depending on P parameter value Decimal(P, S) is a synonym for:
* *P from [ 1 : 9 ] - for Decimal32(S)*
* *P from [ 10 : 18 ] - for Decimal64(S)*
* *P from [ 19 : 38 ] - for Decimal128(S)*
* *P from [ 39 : 76 ] - for Decimal256(S)*
we can refer to doc with:
[https://clickhouse.com/docs/sql-reference/data-types/decimal]
eg:{*}select cast(\"product_id\" as decimal(22,20)) from \"product\"{*}
but transform to: *SELECT CAST(`product_id` AS DECIMAL(19, 19)) FROM
`foodmart`.`product`*
this should be transform to: *SELECT CAST(`product_id` AS DECIMAL(22, 20))
FROM `foodmart`.`product`*
because CK precision is from[1, 79]
was:
Currently Calcite not support Decimal type in ClickHouse dialect.
In ClickHouse:
* *P - precision. Valid range: [ 1 : 76 ].*
* *S - scale. Valid range: [ 0 : P ].*
Depending on P parameter value Decimal(P, S) is a synonym for:
* *P from [ 1 : 9 ] - for Decimal32(S)*
* *P from [ 10 : 18 ] - for Decimal64(S)*
* *P from [ 19 : 38 ] - for Decimal128(S)*
* *P from [ 39 : 76 ] - for Decimal256(S)*
we can refer to doc with:
[https://clickhouse.com/docs/sql-reference/data-types/decimal]
> ClickHouse Dailect can not support accurate precision
> -----------------------------------------------------
>
> Key: CALCITE-6909
> URL: https://issues.apache.org/jira/browse/CALCITE-6909
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.39.0
> Reporter: Yu Xu
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> Currently ClickHouse Dailect can not support accurate precision
> In ClickHouse:
> * *P - precision. Valid range: [ 1 : 76 ].*
> * *S - scale. Valid range: [ 0 : P ].*
> Depending on P parameter value Decimal(P, S) is a synonym for:
> * *P from [ 1 : 9 ] - for Decimal32(S)*
> * *P from [ 10 : 18 ] - for Decimal64(S)*
> * *P from [ 19 : 38 ] - for Decimal128(S)*
> * *P from [ 39 : 76 ] - for Decimal256(S)*
> we can refer to doc with:
> [https://clickhouse.com/docs/sql-reference/data-types/decimal]
>
> eg:{*}select cast(\"product_id\" as decimal(22,20)) from \"product\"{*}
> but transform to: *SELECT CAST(`product_id` AS DECIMAL(19, 19)) FROM
> `foodmart`.`product`*
>
> this should be transform to: *SELECT CAST(`product_id` AS DECIMAL(22, 20))
> FROM `foodmart`.`product`*
> because CK precision is from[1, 79]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)