joewitt commented on code in PR #9933:
URL: https://github.com/apache/nifi/pull/9933#discussion_r2083603268


##########
nifi-extension-bundles/nifi-basex-bundle/nifi-basex-processors/src/main/java/org/apache/nifi/processors/basex/EvaluateBaseXQuery.java:
##########
@@ -0,0 +1,277 @@
+/*
+ * 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.processors.basex;
+
+
+import org.apache.nifi.annotation.behavior.*;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.*;
+import org.apache.nifi.expression.AttributeExpression;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.basex.core.Context;
+import org.basex.core.Prop;
+import org.basex.io.IOContent;
+import org.basex.query.QueryException;
+import org.basex.query.QueryProcessor;
+import org.basex.query.value.Value;
+import org.basex.query.value.item.Item;
+import org.basex.query.value.node.DBNode;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+
+@SideEffectFree
+@SupportsBatching
+@Tags({"XML", "evaluate", "XPath", "XQuery", "basex"})
+@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED)
+@CapabilityDescription(
+        "Executes an XQuery expression using the BaseX engine, passing the 
FlowFile content as a string context to the script. "
+                + "An XQuery script must be provided for the processor to run. 
Users can choose how FlowFile attributes are mapped "
+                + "to external variables: map all attributes, map only a 
specific list, or ignore attributes altogether. "
+                + "The output of the query can be written to a specified 
FlowFile attribute (similarly to the InvokeHTTP processor) "
+                + "or used to replace the content of the original FlowFile. 
The processor defines the following relationships: "
+                + "'success' (on successful execution), 'failure' (if the 
script fails), and 'original' (preserves the unmodified FlowFile)."
+)
+@SystemResourceConsiderations({
+        @SystemResourceConsideration(resource = SystemResource.MEMORY, 
description = "Processing requires reading the entire FlowFile into memory")

Review Comment:
   it is good this is here - but I'd recommend making it more dramatic in 
description.
   
   As currently written the entire content of the flowfile is read into memory 
and I think as written that might be twice the size at least.  On serialization 
it is also at least once but might be twice as well.  Either way this is for 
large XML documents a serious consideration for users.



-- 
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]

Reply via email to