Sergey Nuyanzin created CALCITE-4603:
----------------------------------------
Summary: Least restrictive type considers only the last element in
collections of collections
Key: CALCITE-4603
URL: https://issues.apache.org/jira/browse/CALCITE-4603
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.26.0
Reporter: Sergey Nuyanzin
It seems least restrictive always returns the type of the last element from the
collection.
For instance for
{code:sql}
select array[array['hello'], array['world'], array['!']] as "array"
{code}
least restrictive gives {{CHAR(1) ARRAY ARRAY}} instead of {{CHAR(5) ARRAY
ARRAY}}
for
{code:sql}
select map[map[1.1, 2.1], map[1.1, 2.1], map[1, 1], map[1, 1]] as "map";
{code}
least restrictive gives {{((INTEGER, INTEGER) MAP, (INTEGER, INTEGER) MAP)
MAP}} instead of \{{((DECIMAL(2, 1), DECIMAL(2, 1)) MAP, (DECIMAL(2, 1),
DECIMAL(2, 1)) MAP) MAP }}
for
{code:sql}
select multiset[array['hello'], array['world'], array['!']] as "multiset";
{code}
least restrictive gives \{{CHAR(1) ARRAY MULTISET }} instead of \{{CHAR(5)
ARRAY MULTISET }}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)