exceptionfactory commented on code in PR #8182:
URL: https://github.com/apache/nifi/pull/8182#discussion_r1436642165
##########
nifi-docs/src/main/asciidoc/record-path-guide.adoc:
##########
@@ -1122,6 +1122,35 @@ Would yield a value of `2`. We could also use this as a
filter, such as:
Which will return the `id` element with a value of `1234`.
+=== map
+
+Creates a map of Strings with the given parameters. For example, if we have
the following record:
+
+----
+{
+ "firstName": "John",
+ "lastName": "Snow"
+}
+----
+
+We could use the `UpdateRecord` processor with
+
+----
+/fullName => map("firstName", /firstName, "lastName", /lastName)
Review Comment:
Would it be better to qualify the function name to something else? The name
`map` can also connote other types of streaming functions in the context of
Java, so maybe something more specific would be better.
##########
nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/functions/Map.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.record.path.functions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.nifi.record.path.FieldValue;
+import org.apache.nifi.record.path.RecordPathEvaluationContext;
+import org.apache.nifi.record.path.StandardFieldValue;
+import org.apache.nifi.record.path.paths.RecordPathSegment;
+import org.apache.nifi.serialization.SimpleRecordSchema;
+import org.apache.nifi.serialization.record.MapRecord;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.serialization.record.RecordField;
+import org.apache.nifi.serialization.record.RecordFieldType;
+import org.apache.nifi.serialization.record.RecordSchema;
+
+public class Map extends RecordPathSegment {
Review Comment:
Are there any concerns about this class name colliding with the
`java.util.Map` interface? Although the function name could still be `map`,
what do you think about making the class name different?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]