[
https://issues.apache.org/jira/browse/METAMODEL-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15048231#comment-15048231
]
ASF GitHub Bot commented on METAMODEL-195:
------------------------------------------
Github user albertostratio commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/70#discussion_r47059528
--- Diff: core/src/main/java/org/apache/metamodel/query/SelectItem.java ---
@@ -152,7 +166,24 @@ public SelectItem(Column column, FromItem fromItem) {
* @param fromItem
*/
public SelectItem(FunctionType function, Column column, FromItem
fromItem) {
- this(column, fromItem, function, null, null, null, false);
+ this(column, fromItem, function, null, null, null, null, false);
+ if (column == null) {
+ throw new IllegalArgumentException("column=null");
+ }
+ }
+
+ /**
+ * Creates a SelectItem that uses a function with parameters on a
column
+ * from a particular {@link FromItem}, for example
+ * MAP_VALUE('path.to.value', doc)
+ *
+ * @param function
+ * @param functionParameters
+ * @param column
+ * @param fromItem
+ */
+ public SelectItem(FunctionType function, Object[] functionParameters,
Column column, FromItem fromItem) {
+ this(column, fromItem, function, functionParameters, null, null,
null, false);
--- End diff --
Same comment as above
> Scalar function to get key from a MAP type field
> ------------------------------------------------
>
> Key: METAMODEL-195
> URL: https://issues.apache.org/jira/browse/METAMODEL-195
> Project: Apache MetaModel
> Issue Type: Improvement
> Reporter: Kasper Sørensen
>
> Now that we have support for scalar functions, and we also support a host of
> key/value or document oriented datastores, I think it would be really natural
> to support a function for getting a value inside a map.
> Example:
> {code}
> SELECT MAP_VALUE(address, 'street') FROM contacts
> {code}
> Ideally the function would allow for a full "path" of keys so that you could
> have maps-within-maps and so on.
> {code}
> SELECT MAP_VALUE(address, 'homeaddress.street') FROM contacts
> {code}
> Even more ideally we would also add a bit of query parser logic to allow
> expressing the path as part of the operand itself:
> {code}
> SELECT address.homeaddress.street FROM contacts
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)