com.marklogic.spark.reader.customcode.CustomCodePartitionReaderFactory 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.reader.customcode;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.connector.read.InputPartition;
import org.apache.spark.sql.connector.read.PartitionReader;
import org.apache.spark.sql.connector.read.PartitionReaderFactory;
class CustomCodePartitionReaderFactory implements PartitionReaderFactory {
static final long serialVersionUID = 1;
private CustomCodeContext customCodeContext;
public CustomCodePartitionReaderFactory(CustomCodeContext customCodeContext) {
this.customCodeContext = customCodeContext;
}
@Override
public PartitionReader createReader(InputPartition partition) {
return new CustomCodePartitionReader(customCodeContext, ((CustomCodePartition) partition).getPartition());
}
}