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

com.marklogic.spark.reader.document.ForestReaderFactory 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.reader.document;

import com.marklogic.spark.reader.file.TripleRowSchema;
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 ForestReaderFactory implements PartitionReaderFactory {

    static final long serialVersionUID = 1;

    private DocumentContext documentContext;

    ForestReaderFactory(DocumentContext documentContext) {
        this.documentContext = documentContext;
    }

    @Override
    public PartitionReader createReader(InputPartition partition) {
        return TripleRowSchema.SCHEMA.equals(documentContext.getSchema()) ?
            new OpticTriplesReader((ForestPartition) partition, documentContext) :
            new ForestReader((ForestPartition) partition, documentContext);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy