ompute.logical-plan.0.2.1.source-code.DataFrame.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logical-plan Show documentation
Show all versions of logical-plan Show documentation
JVM query engine based on Apache Arrow
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
}
}