-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new execution plan types to
plan-types
crate (#1363)
<!-- The PR description should answer 2 important questions: --> ### What Adds the types required for the new execution planning to the `plan-types` crate. Some of these lived in `graphql-ir`, so have been removed from there. Functional no-op. V3_GIT_ORIGIN_REV_ID: 0e39aca2d35a7fe69382363b2cef8a028e9be86e
- Loading branch information
1 parent
b810b99
commit e6f56f8
Showing
23 changed files
with
428 additions
and
100 deletions.
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 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
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
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
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
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,12 @@ | ||
//! new execution plan types, entirely separate from `execute` crate | ||
mod aggregates; | ||
mod arguments; | ||
mod field; | ||
mod filter; | ||
mod order_by; | ||
mod query; | ||
mod relationships; | ||
|
||
pub use aggregates::{AggregateFieldSelection, AggregateSelectionSet}; | ||
pub use order_by::{OrderByDirection, OrderByElement, OrderByTarget}; | ||
pub use query::QueryExecutionPlan; |
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,43 @@ | ||
use crate::NdcFieldAlias; | ||
use indexmap::IndexMap; | ||
use nonempty::NonEmpty; | ||
use open_dds::{ | ||
aggregates::DataConnectorAggregationFunctionName, data_connector::DataConnectorColumnName, | ||
}; | ||
use serde::Serialize; | ||
use std::hash::Hash; | ||
|
||
/// IR that represents the selected fields of an output type. | ||
#[derive(Debug, Serialize, Default, PartialEq, Clone, Eq)] | ||
pub struct AggregateSelectionSet { | ||
// The fields in the selection set. They are stored in the form that would | ||
// be converted and sent over the wire. Serialized the map as ordered to | ||
// produce deterministic golden files. | ||
pub fields: IndexMap<NdcFieldAlias, AggregateFieldSelection>, | ||
} | ||
|
||
// FIXME: remove this; this is probably inaccurate. | ||
// https://github.com/indexmap-rs/indexmap/issues/155 | ||
// Probably use ordermap (ref: https://github.com/indexmap-rs/indexmap/issues/67#issuecomment-2189801441) | ||
impl Hash for AggregateSelectionSet { | ||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | ||
for (k, v) in &self.fields { | ||
k.hash(state); | ||
v.hash(state); | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Serialize, PartialEq, Clone, Eq, Hash)] | ||
pub enum AggregateFieldSelection { | ||
Count { | ||
column_path: Vec<DataConnectorColumnName>, | ||
}, | ||
CountDistinct { | ||
column_path: Vec<DataConnectorColumnName>, | ||
}, | ||
AggregationFunction { | ||
function_name: DataConnectorAggregationFunctionName, | ||
column_path: NonEmpty<DataConnectorColumnName>, | ||
}, | ||
} |
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,19 @@ | ||
use super::filter::ResolvedFilterExpression; | ||
|
||
use crate::VariableName; | ||
|
||
/// Argument plan to express various kinds of arguments | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
pub enum Argument { | ||
/// The argument is provided as a literal value | ||
Literal { | ||
value: serde_json::Value, | ||
}, | ||
/// The argument is provided by reference to a variable | ||
Variable { | ||
name: VariableName, | ||
}, | ||
BooleanExpression { | ||
predicate: ResolvedFilterExpression, | ||
}, | ||
} |
Oops, something went wrong.