-
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
Merged
dlurton
merged 15 commits into
physical-plan-staging
from
physical-plan-staging-planner-pipeline
May 24, 2022
Merged
Add PlannerPipeline #590
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
48a003e
Add 3 query planner passes.
dlurton a5bd78b
Address build failures
dlurton befac52
Add FILTER_DISTINCT ExprFunction
dlurton 10ebc0e
Add PlannerPipeline
dlurton ebd36d3
Merge branch 'physical-plan-staging' into physical-plan-staging-plann…
dlurton f18b6bb
Fix post-merge build failures
dlurton 77a4ec5
Make ktlint happy
dlurton 8383b55
Renames UniqueIdResolver to MetadataResolver
dlurton 4a780a2
Merge branch 'physical-plan-staging-metadata-resolver' into physical-…
dlurton 7d84673
emptySchemaResolver -> emptyMetadataResolver
dlurton 6f5d1ec
Merge branch 'physical-plan-staging-metadata-resolver' into physical-…
dlurton 2dd95c7
Fix dependent code after merge
dlurton a2ced51
Account for name change
dlurton 9f25f3f
Update comments
dlurton 2cb4314
Remove custom functions, procedures and types from Planner API
dlurton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 EvaluatorOptions: | ||
|
||
- 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). | ||
- EvaluatorOptions.allowUndefinedVariables is new. | ||
- EvaluatorOptions has no equivalent for CompileOptions.undefinedVariableBehavior -- this was added for backward | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.