You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Andrei Sereda (JIRA)" <ji...@apache.org> on 2019/05/08 23:28:00 UTC

[jira] [Updated] (CALCITE-3056) Elasticsearch adapter. Invalid result with cast function on raw queries

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

Andrei Sereda updated CALCITE-3056:
-----------------------------------
    Description: 
Raw elastic queries (not based on views) return incorrect result when {{cast}} function is used.

{code:sql}

-- does not work without view (returns null)
select max(cast(_MAP['foo'] as integer)) from elastic

-- query based on view works
create view elasticview as select cast(_MAP['foo'] as integer) as foo from elastic; 
-- works
select max(foo) from elasticview 
{code}

This seems a little counterintuitive, since casting is not pushed to elastic, but consistent with existing view functionality. 

  was:
Raw elastic queries (not based on views) return incorrect result when {{cast}} function is used.

{code:sql}

-- does not work without view (returns null)
select max(cast(_MAP['foo'] as integer)) from elastic

-- query based on view works
create view elasticview as select cast(_MAP['foo'] as integer) as foo from elastic; 
-- works
select max(foo) from elasticview 
{code}



> Elasticsearch adapter. Invalid result with cast function on raw queries
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-3056
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3056
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>    Affects Versions: 1.19.0
>            Reporter: Andrei Sereda
>            Assignee: Andrei Sereda
>            Priority: Major
>
> Raw elastic queries (not based on views) return incorrect result when {{cast}} function is used.
> {code:sql}
> -- does not work without view (returns null)
> select max(cast(_MAP['foo'] as integer)) from elastic
> -- query based on view works
> create view elasticview as select cast(_MAP['foo'] as integer) as foo from elastic; 
> -- works
> select max(foo) from elasticview 
> {code}
> This seems a little counterintuitive, since casting is not pushed to elastic, but consistent with existing view functionality. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)