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

com.marklogic.spark.writer.customcode.CustomCodeWriterFactory 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.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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy