com.marklogic.spark.writer.file.DocumentFileWriteBuilder 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.file;
import org.apache.spark.sql.connector.write.BatchWrite;
import org.apache.spark.sql.connector.write.Write;
import org.apache.spark.sql.connector.write.WriteBuilder;
import org.apache.spark.sql.types.StructType;
import java.util.Map;
public class DocumentFileWriteBuilder implements WriteBuilder {
private final Map properties;
private final StructType schema;
public DocumentFileWriteBuilder(Map properties, StructType schema) {
this.properties = properties;
this.schema = schema;
}
@Override
public Write build() {
return new Write() {
@Override
public BatchWrite toBatch() {
return new DocumentFileBatch(properties, schema);
}
};
}
}