All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.marklogic.spark.writer.RowConverter Maven / Gradle / Ivy

There is a newer version: 2.4.2
Show newest version
/*
 * 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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy