ddanielr commented on code in PR #4898:
URL: https://github.com/apache/accumulo/pull/4898#discussion_r1938074242


##########
core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriter.java:
##########
@@ -250,5 +259,27 @@ public void append(Iterable<Entry<Key,Value>> keyValues) 
throws IOException {
   @Override
   public void close() throws IOException {
     writer.close();
+    loadPlanCollector.close();
+  }
+
+  /**
+   * If no split resolver was provided when the RFileWriter was built then 
this method will return a
+   * simple load plan of type {@link 
org.apache.accumulo.core.data.LoadPlan.RangeType#FILE} using
+   * the first and last row seen. If a splitResolver was provided then this 
will return a load plan
+   * of type {@link org.apache.accumulo.core.data.LoadPlan.RangeType#TABLE} 
that has the split
+   * ranges the rows written overlapped.
+   *
+   * @param filename This file name will be used in the load plan and it 
should match the name that
+   *        will be used when bulk importing this file. Only a filename is 
needed, not a full path.
+   * @return load plan computed from the keys written to the rfile.
+   * @see 
org.apache.accumulo.core.client.rfile.RFile.WriterOptions#withSplitResolver(LoadPlan.SplitResolver)
+   * @since 2.1.4
+   * @throws IllegalStateException is attempting to get load plan before 
calling {@link #close()}
+   * @throws IllegalArgumentException is a full path is passed instead of a 
filename
+   */
+  public LoadPlan getLoadPlan(String filename) {
+    Preconditions.checkArgument(!filename.contains("/"),
+        "Unexpected path %s seen instead of file name", filename);
+    return loadPlanCollector.getLoadPlan(filename);

Review Comment:
   Called this out specifically in #5271 



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