Repository navigation
feat: Elastic DSL in asap-planner-rs #327
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
35e3cf0
Initial Elastic DSL path in planner. Logic almost 1-1 of SQL since we…
Kolleida 90e24e5
Add index specific mappings (schemas) for Elastic DSL in planner (sim…
Kolleida 26e66d9
Add more integration tests (ES DSL planner).
Kolleida ea8a24b
Merge branch 'main' into try-merge
Kolleida 3bca6c3
Refactor/rearrange Elastic DSL changes to match new crate layout.
Kolleida 018fc81
Cargo fmt and clippy.
Kolleida 14aad8b
- Make criteria for inferring time field stricter: fieldname must eit…
Kolleida 6301677
Change ElasticMappingSchema add_index to take mut ref instead of cons…
Kolleida 6f6ea0c
Fix infer time heuristic check.
Kolleida 6014eda
Fix planner only extracting time range if it is the first predicate. …
Kolleida 74c3865
Require explicit specification of time field for each query group
Kolleida 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,45 @@ | ||
| use std::path::Path; | ||
|
|
||
| use crate::config::input::ElasticDSLControllerConfig; | ||
| use crate::elastic_dsl::generator::{generate_elastic_plan, ElasticRuntimeOptions}; | ||
| use crate::error::ControllerError; | ||
| use crate::planner_output::PlannerOutput; | ||
|
|
||
| pub struct ElasticController { | ||
| config: ElasticDSLControllerConfig, | ||
| options: ElasticRuntimeOptions, | ||
| } | ||
|
|
||
| impl ElasticController { | ||
| pub fn new(config: ElasticDSLControllerConfig, options: ElasticRuntimeOptions) -> Self { | ||
| Self { config, options } | ||
| } | ||
|
|
||
| pub fn from_file(path: &Path, opts: ElasticRuntimeOptions) -> Result<Self, ControllerError> { | ||
| let yaml_str = std::fs::read_to_string(path)?; | ||
| Self::from_yaml(&yaml_str, opts) | ||
| } | ||
|
|
||
| pub fn from_yaml(yaml: &str, opts: ElasticRuntimeOptions) -> Result<Self, ControllerError> { | ||
| let config: ElasticDSLControllerConfig = serde_yaml::from_str(yaml)?; | ||
| Ok(Self { | ||
| config, | ||
| options: opts, | ||
| }) | ||
| } | ||
|
|
||
| pub fn generate(&self) -> Result<PlannerOutput, ControllerError> { | ||
| let output = generate_elastic_plan(&self.config, &self.options)?; | ||
| Ok(PlannerOutput::from_output(output)) | ||
| } | ||
|
|
||
| pub fn generate_to_dir(&self, dir: &Path) -> Result<PlannerOutput, ControllerError> { | ||
| let output = self.generate()?; | ||
| std::fs::create_dir_all(dir)?; | ||
| let streaming_str = serde_yaml::to_string(output.streaming_yaml())?; | ||
| let inference_str = serde_yaml::to_string(output.inference_yaml())?; | ||
| std::fs::write(dir.join("streaming_config.yaml"), streaming_str)?; | ||
| std::fs::write(dir.join("inference_config.yaml"), inference_str)?; | ||
| Ok(output) | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.