com.marklogic.spark.writer.customcode.CustomCodeWriterFactory 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.customcode;
import com.marklogic.spark.reader.customcode.CustomCodeContext;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.connector.write.DataWriter;
import org.apache.spark.sql.connector.write.DataWriterFactory;
import org.apache.spark.sql.connector.write.streaming.StreamingDataWriterFactory;
public class CustomCodeWriterFactory implements DataWriterFactory, StreamingDataWriterFactory {
private CustomCodeContext customCodeContext;
public CustomCodeWriterFactory(CustomCodeContext customCodeContext) {
this.customCodeContext = customCodeContext;
}
@Override
public DataWriter createWriter(int partitionId, long taskId) {
return new CustomCodeWriter(customCodeContext);
}
@Override
public DataWriter createWriter(int partitionId, long taskId, long epochId) {
return new CustomCodeWriter(customCodeContext);
}
}