[
https://issues.apache.org/jira/browse/METAMODEL-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096544#comment-15096544
]
ASF GitHub Bot commented on METAMODEL-224:
------------------------------------------
Github user albertostratio commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/85#discussion_r49618013
--- 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 --
@kaspersorensen that was my first approach but I found a lot of problems
when we don't have a column within the SelectItem. I guess the CONCAT function
is a quite particular case because it might receive several columns but most of
the rest of the scalar functions we will be receiving just one column.
I would keep this approach as a first attempt and then when we implementing
another string scalar functions, such as SUBSTRING, evaluate whether this
approach fits for the rest of them and if not we can modify it. What do you
think?
> 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)