-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PlannerPipeline #590
Add PlannerPipeline #590
Changes from 13 commits
48a003e
a5bd78b
befac52
10ebc0e
ebd36d3
f18b6bb
77a4ec5
8383b55
4a780a2
7d84673
6f5d1ec
2dd95c7
a2ced51
9f25f3f
2cb4314
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package org.partiql.lang.planner | ||
|
||
import org.partiql.lang.eval.ProjectionIterationBehavior | ||
import org.partiql.lang.eval.ThunkOptions | ||
import org.partiql.lang.eval.TypedOpBehavior | ||
import org.partiql.lang.eval.TypingMode | ||
import java.time.ZoneOffset | ||
|
||
/* | ||
|
||
Differences between CompilerOptions and PlannerOptions: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thanks. Fixing... |
||
|
||
- There is no EvaluatorOptions equivalent for CompileOptions.visitorTransformMode since the planner always runs some basic | ||
normalization and variable resolution passes *before* the customer can inject their own transforms. | ||
- There is no EvaluatorOptions equivalent for CompileOptions.thunkReturnTypeAssertions since PlannerPipeline does not | ||
support the static type inferencer (yet). | ||
- PlannerOptions.allowUndefinedVariables is new. | ||
- PlannerOptions has no equivalent for CompileOptions.undefinedVariableBehavior -- this was added for backward | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
compatibility on behalf of a customer we don't have anymore. Internal bug number is IONSQL-134. | ||
*/ | ||
|
||
/** | ||
* Specifies options that effect the behavior of the PartiQL physical plan evaluator. | ||
* | ||
* @param defaultTimezoneOffset Default timezone offset to be used when TIME WITH TIME ZONE does not explicitly | ||
* specify the time zone. Defaults to [ZoneOffset.UTC]. | ||
*/ | ||
@Suppress("DataClassPrivateConstructor") | ||
data class EvaluatorOptions private constructor ( | ||
val projectionIteration: ProjectionIterationBehavior = ProjectionIterationBehavior.FILTER_MISSING, | ||
val thunkOptions: ThunkOptions = ThunkOptions.standard(), | ||
val typingMode: TypingMode = TypingMode.LEGACY, | ||
val typedOpBehavior: TypedOpBehavior = TypedOpBehavior.LEGACY, | ||
val defaultTimezoneOffset: ZoneOffset = ZoneOffset.UTC | ||
) { | ||
companion object { | ||
|
||
/** | ||
* Creates a java style builder that will choose the default values for any unspecified options. | ||
*/ | ||
@JvmStatic | ||
fun builder() = Builder() | ||
|
||
/** | ||
* Creates a java style builder that will clone the [EvaluatorOptions] passed to the constructor. | ||
*/ | ||
@JvmStatic | ||
fun builder(options: EvaluatorOptions) = Builder(options) | ||
|
||
/** | ||
* Kotlin style builder that will choose the default values for any unspecified options. | ||
*/ | ||
fun build(block: Builder.() -> Unit) = Builder().apply(block).build() | ||
|
||
/** | ||
* Kotlin style builder that will clone the [EvaluatorOptions] passed to the constructor. | ||
*/ | ||
fun build(options: EvaluatorOptions, block: Builder.() -> Unit) = Builder(options).apply(block).build() | ||
|
||
/** | ||
* Creates a [EvaluatorOptions] instance with the standard values for use by the legacy AST compiler. | ||
*/ | ||
@JvmStatic | ||
fun standard() = Builder().build() | ||
} | ||
|
||
/** | ||
* Builds a [EvaluatorOptions] instance. | ||
*/ | ||
class Builder(private var options: EvaluatorOptions = EvaluatorOptions()) { | ||
|
||
fun projectionIteration(value: ProjectionIterationBehavior) = set { copy(projectionIteration = value) } | ||
fun typingMode(value: TypingMode) = set { copy(typingMode = value) } | ||
fun typedOpBehavior(value: TypedOpBehavior) = set { copy(typedOpBehavior = value) } | ||
fun thunkOptions(value: ThunkOptions) = set { copy(thunkOptions = value) } | ||
fun defaultTimezoneOffset(value: ZoneOffset) = set { copy(defaultTimezoneOffset = value) } | ||
|
||
private inline fun set(block: EvaluatorOptions.() -> EvaluatorOptions): Builder { | ||
options = block(options) | ||
return this | ||
} | ||
|
||
fun build() = options | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.:
is a bug
.