com.marklogic.spark.writer.RowConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marklogic-spark-connector Show documentation
Show all versions of marklogic-spark-connector Show documentation
Spark 3 connector for MarkLogic
/*
* Copyright © 2024 MarkLogic Corporation. All Rights Reserved.
*/
package com.marklogic.spark.writer;
import org.apache.spark.sql.catalyst.InternalRow;
import java.util.Iterator;
import java.util.List;
/**
* Strategy interface for how a Spark row is converted into a set of inputs for writing a document to MarkLogic.
*/
public interface RowConverter {
/**
* @param row
* @return an iterator of inputs for creating documents to write to MarkLogic. An iterator is used to allow the
* implementor to return multiple documents if necessary.
*/
Iterator convertRow(InternalRow row);
/**
* Called when {@code WriteBatcherDataWriter} has no more rows to send, but the implementation may have one or
* more documents that haven't been returned yet via {@code convertRow}.
*
* @return
*/
List getRemainingDocumentInputs();
}