[
https://issues.apache.org/jira/browse/CALCITE-6909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17938087#comment-17938087
]
Yu Xu edited comment on CALCITE-6909 at 3/25/25 3:47 AM:
---------------------------------------------------------
Yes, but a problem that DECIMAL only support precision from [1, 9], and this
precision is not fitable when use want to use bigger precision, so here maybe
need to use multiple DECIMAL to support bigger precision for user and Decimal
equivalent to Decimal32, [~nobigo] Can refer as follow :
[https://clickhouse.com/docs/sql-reference/data-types/decimal#decimal-value-ranges]
h2. Decimal Value
Ranges[|https://clickhouse.com/docs/sql-reference/data-types/decimal#decimal-value-ranges]
* Decimal(P, S) - ( -1 * 10^(P - S), 1 * 10^(P - S) )
* Decimal32(S) - ( -1 * 10^(9 - S), 1 * 10^(9 - S) )
* Decimal64(S) - ( -1 * 10^(18 - S), 1 * 10^(18 - S) )
* Decimal128(S) - ( -1 * 10^(38 - S), 1 * 10^(38 - S) )
* Decimal256(S) - ( -1 * 10^(76 - S), 1 * 10^(76 - S) )
At the same time currently ClickHouse dialect in Calcite only support max
precision with 19 which is smaller than max precision in CK(76),this is not
fitable.
was (Author: JIRAUSER307770):
Yes, but a problem that DECIMAL only support precision from [1, 9], and this
precision is not fitable when use want to use bigger precision, so here maybe
need to use multiple DECIMAL to support bigger precision for user and Decimal
equivalent to Decimal32, [~nobigo] Can refer as follow :
[https://clickhouse.com/docs/sql-reference/data-types/decimal#decimal-value-ranges]
h2. Decimal Value
Ranges[|https://clickhouse.com/docs/sql-reference/data-types/decimal#decimal-value-ranges]
* Decimal(P, S) - ( -1 * 10^(P - S), 1 * 10^(P - S) )
* Decimal32(S) - ( -1 * 10^(9 - S), 1 * 10^(9 - S) )
* Decimal64(S) - ( -1 * 10^(18 - S), 1 * 10^(18 - S) )
* Decimal128(S) - ( -1 * 10^(38 - S), 1 * 10^(38 - S) )
* Decimal256(S) - ( -1 * 10^(76 - S), 1 * 10^(76 - S) )
> Support ClickHouse Dailect with more precise Decimal type
> ---------------------------------------------------------
>
> 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 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]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)