how-query-engines-work
how-query-engines-work copied to clipboard
Small question/clarification about whether something would fit into Logical Plans or Physical Plans
To cement my understanding of the book, I'm working through it a second time, this time changing the implementation from using Arrow vectors + types (columnar) to row-based data (Map<String, Any>) and JDBC types:
data class Field(val name: String, val type: JDBCType)
data class Schema(val fields: List<Field>)
interface DataSource {
fun schema(): Schema
fun scan(projection: List<String>): Sequence<Map<String, Any?>>
}
// Physical plans return iterators over rows.
interface PhysicalPlan {
fun schema(): Schema
fun children(): List<PhysicalPlan>
fun execute(): Sequence<Map<String, Any?>>
}
// Physical expression interface
interface Expression {
fun evaluate(rows: Map<String, Any?>): Any?
}
My question is this:
If I have different "translation" strategies for converting Logical Plans to SQL, which then get executed as a IE a JDBC query -- would these be considered different Physical Plans or would they be implementation details of the same Physical Plan?
IE, translating a Logical Plan to a SQL string with StringBuilder, versus using an ORM/Query-builder like jOOQ: