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

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_r49462487
  
    --- Diff: 
core/src/main/java/org/apache/metamodel/query/parser/SelectItemParser.java ---
    @@ -157,6 +161,21 @@ public SelectItem findSelectItem(String expression) 
throws MultipleSelectItemsPa
                 if ("*".equals(columnName)) {
                     throw new MultipleSelectItemsParsedException(fromItem);
                 } else if (fromItem.getTable() != null) {
    +                if (selectItemHasParenthesis) {
    +                    if 
(functionName.equals(FunctionType.CONCAT.getFunctionName())) {
    +                        String[] columnAndParametersAsString = 
expression.split(",");
    +                        Object[] columnAndParameters = new 
Object[columnAndParametersAsString.length];
    +                        int columnAndParamsIndex = 0;
    +                        for (String parameter : 
columnAndParametersAsString) {
    +                            Column column = 
fromItem.getTable().getColumnByName(parameter);
    +                            if (column != null) 
columnAndParameters[columnAndParamsIndex] = column;
    +                            else columnAndParameters[columnAndParamsIndex] 
= parameter.substring(1,parameter.length()-1);
    --- End diff --
    
    We should follow code conventions here and have newline and curly braces so 
that it becomes:
    ```
    if (something) {
      something;
    } else {
      something;
    }
    ```


> 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