[
https://issues.apache.org/jira/browse/IGNITE-22447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-22447:
--------------------------------------
Description:
Numeric aggregate functions accept character string values due to implicit
casts added by type coercion:
{code:java}
SELECT AVG('100')
> Gets transformed into
SELECT AVG("100"::DECIMAL(MAX_PREC, MAX_SCALE))
{code}
*Explanation*
This particular cast is added since AVG function uses FamilyOperandTypeChecker
that always coerces its arguments if possible (it calls
TypeCoercion::builtinFunctionCoercion, which in turn calls
TypeCoercion::implicitCast(t1, t2) .
*Expected behaviour*
Aggregate functions that accept only numeric types should be rejected by the
validator, when called with arguments of other types.
was:
Numeric aggregate functions accept character string values due to implicit
casts added by type coercion:
{code:java}
SELECT AVG('100')
> Gets transformed into
SELECT AVG("100"::DECIMAL(MAX_PREC, MAX_SCALE))
{code}
*Explanation*
This particular cast is added since AVG function uses FamilyOperandTypeChecker
that always coerces its arguments if possible.
*Expected behaviour*
Aggregate functions that accept only numeric types should be rejected by the
validator, when called with arguments of other types.
> Sql. Numeric aggregate functions accept VARCHAR types
> -----------------------------------------------------
>
> Key: IGNITE-22447
> URL: https://issues.apache.org/jira/browse/IGNITE-22447
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Reporter: Maksim Zhuravkov
> Priority: Major
> Labels: ignite-3
>
> Numeric aggregate functions accept character string values due to implicit
> casts added by type coercion:
> {code:java}
> SELECT AVG('100')
> > Gets transformed into
> SELECT AVG("100"::DECIMAL(MAX_PREC, MAX_SCALE))
> {code}
> *Explanation*
> This particular cast is added since AVG function uses
> FamilyOperandTypeChecker that always coerces its arguments if possible (it
> calls TypeCoercion::builtinFunctionCoercion, which in turn calls
> TypeCoercion::implicitCast(t1, t2) .
> *Expected behaviour*
> Aggregate functions that accept only numeric types should be rejected by the
> validator, when called with arguments of other types.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)