You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Harris Mirza (JIRA)" <ji...@apache.org> on 2016/08/29 11:02:20 UTC

[jira] [Commented] (METAMODEL-193) Query parser support for "CAST AS " expression

    [ https://issues.apache.org/jira/browse/METAMODEL-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15445547#comment-15445547 ] 

Harris Mirza commented on METAMODEL-193:
----------------------------------------

This is also important as it causes issues with values returned from aggregates in SQL Sever. If I get the AVG of a column that contains 1,2,3,4 and 5. It will return 2 rather than 2.5. Casting the field to a decimal fixes this.

> Query parser support for "CAST <field> AS <type>" expression
> ------------------------------------------------------------
>
>                 Key: METAMODEL-193
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-193
>             Project: Apache MetaModel
>          Issue Type: Improvement
>            Reporter: Kasper Sørensen
>
> As a natural addition to the work with datatype-converter functions of METAMODEL-192, we could also provide some syntax support for a pretty normal way of converting/casting data types in SQL:
> {code}
> SELECT CAST id AS string FROM table
> {code}
> We have converter functions for strings, numbers, dates and booleans. But they currently require you to use a function style syntax like:
> {code}
> SELECT TO_STRING(id) FROM table
> {code}
> Supporting both syntax styles would be nice for SQL users.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)