Github user kaspersorensen commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/11#discussion_r27147445
--- Diff: core/src/main/java/org/apache/metamodel/query/Query.java ---
@@ -125,9 +125,35 @@ public Query select(String expression) {
if ("*".equals(expression)) {
return selectAll();
}
-
- SelectItem selectItem = findSelectItem(expression, true);
- return select(selectItem);
+
+ String[] possibleSelectItems = splitExpressionByComma(expression);
+ for(String possibleSelectItem : possibleSelectItems) {
+ SelectItem selectItem = findSelectItem(possibleSelectItem,
true);
+ select(selectItem);
+ }
+ return this;
+ }
+
+ /**
+ * If multiple columns or expressions are given in comma seperated
string, this methods splits and generates
+ * string array of expressions representing single column.
+ * @param expression
+ * @return
+ */
+ public String[] splitExpressionByComma(String expression) {
--- End diff --
Maybe we can leverage some of the existing query parser code to do this.
Please have a look at QueryParser class and whatever is related to select item
parsing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---