com.marklogic.spark.reader.file.FileScan 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.file;
import com.marklogic.spark.reader.document.DocumentRowSchema;
import org.apache.spark.sql.connector.read.Batch;
import org.apache.spark.sql.connector.read.Scan;
import org.apache.spark.sql.execution.datasources.PartitioningAwareFileIndex;
import org.apache.spark.sql.types.StructType;
import java.util.Map;
class FileScan implements Scan {
private final Map properties;
private final PartitioningAwareFileIndex fileIndex;
FileScan(Map properties, PartitioningAwareFileIndex fileIndex) {
this.properties = properties;
this.fileIndex = fileIndex;
}
@Override
public StructType readSchema() {
return DocumentRowSchema.SCHEMA;
}
@Override
public Batch toBatch() {
return new FileBatch(properties, fileIndex);
}
}