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

ompute.logical-plan.0.2.1.source-code.DataFrame.kt Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
package org.ballistacompute.logical

import org.ballistacompute.datatypes.Schema

interface DataFrame {

    /** Apply a projection */
    fun project(expr: List): DataFrame

    /** Apply a filter */
    fun filter(expr: LogicalExpr): DataFrame

    /** Aggregate */
    fun aggregate(groupBy: List, aggregateExpr: List): DataFrame

    /** Returns the schema of the data that will be produced by this DataFrame. */
    fun schema(): Schema

    /** Get the logical plan */
    fun logicalPlan() : LogicalPlan

}

class DataFrameImpl(private val plan: LogicalPlan) : DataFrame {

    override fun project(expr: List): DataFrame {
        return DataFrameImpl(Projection(plan, expr))
    }

    override fun filter(expr: LogicalExpr): DataFrame {
        return DataFrameImpl(Selection(plan, expr))
    }

    override fun aggregate(groupBy: List,
                           aggregateExpr: List): DataFrame {
        return DataFrameImpl(Aggregate(plan, groupBy, aggregateExpr))
    }

    override fun schema(): Schema {
        return plan.schema()
    }

    override fun logicalPlan(): LogicalPlan {
        return plan
    }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy