[
https://issues.apache.org/jira/browse/CALCITE-7048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu updated CALCITE-7048:
---------------------------
Description:
In https://issues.apache.org/jira/browse/CALCITE-6771 Float should convert to
Double,But it has not been completely solved. Currently, it does not support
conversion of complex types such as map/array.
eg:
{code:java}
"SELECT CAST(MAP[1.0,MAP[3.0,4.0]]"
+ " AS MAP<FLOAT, MAP<FLOAT, FLOAT>>)"
+ " FROM \"employee\""; {code}
current would convert to:
{code:java}
"SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
FLOAT, MAP< FLOAT, FLOAT > >)\nFROM \"foodmart\".\"employee\"" {code}
should convert to:
{code:java}
"SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
DOUBLE, MAP< DOUBLE, DOUBLE > >)\nFROM \"foodmart\".\"employee\"" {code}
*test them in presto env:*
{code:java}
presto> SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS
MAP< DOUBLE, MAP< DOUBLE, DOUBLE > >);
_col0
-----------------
{1.0={3.0=4.0}}
(1 row)Query 20250603_014324_07282_cqcdm, FINISHED, 1 node
Splits: 17 total, 17 done (100.00%)
[Latency: client-side: 72ms, server-side: 29ms] [0 rows, 0B] [0 rows/s,
0B/s]presto> SELECT CAST(ARRAY[ARRAY[1.0], ARRAY[2.0], ARRAY[3.0]] AS DOUBLE
ARRAY ARRAY);
_col0
-----------------------
[[1.0], [2.0], [3.0]]
(1 row)Query 20250603_014346_07324_cqcdm, FINISHED, 1 node
Splits: 17 total, 17 done (100.00%)
[Latency: client-side: 102ms, server-side: 90ms] [0 rows, 0B] [0 rows/s, 0B/s]
{code}
confirm that presto support map/array cast.
so we need to fix it.
was:
In https://issues.apache.org/jira/browse/CALCITE-6771 Float should convert to
Double,But it has not been completely solved. Currently, it does not support
conversion of complex types such as map/array.
eg:
{code:java}
"SELECT CAST(MAP[1.0,MAP[3.0,4.0]]"
+ " AS MAP<FLOAT, MAP<FLOAT, FLOAT>>)"
+ " FROM \"employee\""; {code}
current would convert to:
{code:java}
"SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
FLOAT, MAP< FLOAT, FLOAT > >)\nFROM \"foodmart\".\"employee\"" {code}
should convert to:
{code:java}
"SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
DOUBLE, MAP< DOUBLE, DOUBLE > >)\nFROM \"foodmart\".\"employee\"" {code}
we need to fix it.
> The specified type conversion does not support complex types in Presto
> ----------------------------------------------------------------------
>
> Key: CALCITE-7048
> URL: https://issues.apache.org/jira/browse/CALCITE-7048
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.40.0
> Reporter: Yu Xu
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.41.0
>
>
> In https://issues.apache.org/jira/browse/CALCITE-6771 Float should convert to
> Double,But it has not been completely solved. Currently, it does not support
> conversion of complex types such as map/array.
> eg:
> {code:java}
> "SELECT CAST(MAP[1.0,MAP[3.0,4.0]]"
> + " AS MAP<FLOAT, MAP<FLOAT, FLOAT>>)"
> + " FROM \"employee\""; {code}
> current would convert to:
> {code:java}
> "SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
> FLOAT, MAP< FLOAT, FLOAT > >)\nFROM \"foodmart\".\"employee\"" {code}
> should convert to:
> {code:java}
> "SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS MAP<
> DOUBLE, MAP< DOUBLE, DOUBLE > >)\nFROM \"foodmart\".\"employee\"" {code}
>
> *test them in presto env:*
> {code:java}
> presto> SELECT CAST(MAP (ARRAY[1.0], ARRAY[MAP (ARRAY[3.0], ARRAY[4.0])]) AS
> MAP< DOUBLE, MAP< DOUBLE, DOUBLE > >);
> _col0
> -----------------
> {1.0={3.0=4.0}}
> (1 row)Query 20250603_014324_07282_cqcdm, FINISHED, 1 node
> Splits: 17 total, 17 done (100.00%)
> [Latency: client-side: 72ms, server-side: 29ms] [0 rows, 0B] [0 rows/s,
> 0B/s]presto> SELECT CAST(ARRAY[ARRAY[1.0], ARRAY[2.0], ARRAY[3.0]] AS DOUBLE
> ARRAY ARRAY);
> _col0
> -----------------------
> [[1.0], [2.0], [3.0]]
> (1 row)Query 20250603_014346_07324_cqcdm, FINISHED, 1 node
> Splits: 17 total, 17 done (100.00%)
> [Latency: client-side: 102ms, server-side: 90ms] [0 rows, 0B] [0 rows/s,
> 0B/s] {code}
> confirm that presto support map/array cast.
> so we need to fix it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)