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

ASF GitHub Bot commented on METAMODEL-224:
------------------------------------------

Github user kaspersorensen commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/85#discussion_r49636369
  
    --- Diff: 
core/src/test/java/org/apache/metamodel/QueryPostprocessDataContextTest.java ---
    @@ -294,6 +294,29 @@ public void testScalarFunctionWhere() throws Exception 
{
             ds.close();
         }
     
    +    public void testScalarFunctionConcat() throws Exception {
    +        MockDataContext dc = new MockDataContext("sch", "tab", "1");
    +        Table table = dc.getDefaultSchema().getTables()[0];
    +        MutableColumn col = new MutableColumn("foo").setTable(table);
    +        MutableColumn col2 = new MutableColumn("bar").setTable(table);
    +        Object[] functionParams = new Object[3];
    +        functionParams[0] = col;
    +        functionParams[1] = "$";
    +        functionParams[2] = col2;
    +        Query query = dc.query()
    +                .from(table)
    +                .select(col, FunctionType.CONCAT, functionParams)
    --- End diff --
    
    But my concern is actually that in this case you may also have many columns 
(or rather I prefer to think of it as SelectItems because even those could (one 
day when we support it) be function calls), for instance:
    
    ```
    SELECT CONCAT( name, " ", TO_STRING(age), " - ", hometown ) FROM people
    ```
    
    ... but today we might settle on "only" supporting simple selectitems as 
parameters, so:
    ```
    SELECT CONCAT( name, " ", age, " - ", hometown ) FROM people
    ```
    ... that would for me be a reasonable limitation for a first version.
    
    But my worry is that if it's a problem to not have a column in the 
SelectItem then I'm sure it's also a problem that we have (in the above case) 
essentially 3 columns referred. I can imagine that this would work mostly then 
based on coincidence (maybe age and hometown are also materialized by some 
coincidence rather than conscious design). I know this is maybe making life 
hard on you, but it feels wrong to go ahead with a solution that feels unstable 
because of this.


> Support CONCAT function
> -----------------------
>
>                 Key: METAMODEL-224
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-224
>             Project: Apache MetaModel
>          Issue Type: New Feature
>            Reporter: Alberto
>            Priority: Minor
>
> As we now support scalar functions it would be great to add support for a 
> CONCAT function that allow us to concatenate and append strings to the query 
> results.



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

Reply via email to