[ 
https://issues.apache.org/jira/browse/IGNITE-19106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Iurii Gerzhedovich updated IGNITE-19106:
----------------------------------------
    Labels: ignite-3  (was: calcite3-required ignite-3)

> Sql. Column namings are partially broken after upgrading to calcite 1.34
> ------------------------------------------------------------------------
>
>                 Key: IGNITE-19106
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19106
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 3.0.0-beta1
>            Reporter: Evgeny Stanilovsky
>            Assignee: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> After upgrading to calcite 1.34 SqlValidator#deriveAlias and overloading call 
> IgniteSqlValidator#deriveAlias is changed, thus requests like :
> select v / 2 from t, return EXPR$ instead of column name derived from 
> IgniteSqlValidator#deriveAlias. Fast (near) fix looks like cover both such 
> queries:
> Check annotation for: SqlValidatorImpl#deriveAlias
> IgnitePlanner#validateAndGetTypeMetadata ->
> {noformat}
>     public ValidationResult validateAndGetTypeMetadata(SqlNode sqlNode) {
>         SqlNode validatedNode = validator().validate(sqlNode);
>         RelDataType type = validator().getValidatedNodeType(validatedNode);
>         List<List<String>> origins = 
> validator().getFieldOrigins(validatedNode);
>         List<String> derived = Collections.emptyList();
>         if (sqlNode instanceof SqlSelect) {
>             SelectScope list = validator().getRawSelectScope((SqlSelect) 
> sqlNode);
>             assert type.getFieldList().size() == 
> list.getExpandedSelectList().size();
>             int cnt = 0;
>             derived = new ArrayList<>(list.getExpandedSelectList().size());
>             for (SqlNode node : list.getExpandedSelectList()) {
>                 derived.add(validator().deriveAlias(node, cnt++));
>             }
>         }
>         return new ValidationResult(validatedNode, type, origins, derived);
>     }
> {noformat}
> and use this derived instead of aliases here:
> PrepareServiceImpl#resultSetMetadata
> *Be careful !* .net and cpp tests are involved too, check all issue number 
> occurrences.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to