这是indexloc提供的服务,不要输入任何密码
Skip to content

update to ndc-spec v0.2.0 release tag #159

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ resolver = "2"
# The tag or rev of ndc-models must match the locked tag or rev of the
# ndc-models dependency of ndc-sdk
[workspace.dependencies]
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", rev = "643b96b8ee4c8b372b44433167ce2ac4de193332" }
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.2.0-rc.2" }
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", rev = "v0.6.0" }
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.2.0" }

indexmap = { version = "2", features = [
"serde",
] } # should match the version that ndc-models uses
itertools = "^0.13.0"
itertools = "^0.14.0"
mongodb = { version = "^3.1.0", features = ["tracing-unstable"] }
nonempty = "^0.11.0"
schemars = "^0.8.12"
Expand Down
7 changes: 0 additions & 7 deletions crates/mongodb-agent-common/src/query/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,6 @@ fn serialize_groups(

let aggregates = serialize_aggregates(mode, path, &grouping.aggregates, doc)?;

// TODO: This conversion step can be removed when the aggregates map key type is
// changed from String to FieldName
let aggregates = aggregates
.into_iter()
.map(|(key, value)| (key.to_string(), value))
.collect();

Ok(Group {
dimensions,
aggregates,
Expand Down
2 changes: 2 additions & 0 deletions crates/mongodb-agent-common/src/scalar_types_capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ fn extended_json_scalar_type() -> (ndc_models::ScalarTypeName, ScalarType) {
(name, ndc_definition)
})
.collect(),
extraction_functions: Default::default(),
},
)
}
Expand All @@ -97,6 +98,7 @@ fn make_scalar_type(bson_scalar_type: BsonScalarType) -> (ndc_models::ScalarType
representation: bson_scalar_type_representation(bson_scalar_type),
aggregate_functions: bson_aggregation_functions(bson_scalar_type),
comparison_operators: bson_comparison_operators(bson_scalar_type),
extraction_functions: Default::default(),
};
(scalar_type_name.into(), scalar_type)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mongodb-connector/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub async fn get_schema(config: &MongoConfiguration) -> connector::Result<ndc::S
capabilities: Some(ndc::CapabilitySchemaInfo {
query: Some(ndc::QueryCapabilitiesSchemaInfo {
aggregates: Some(ndc::AggregateCapabilitiesSchemaInfo {
count_scalar_type: BsonScalarType::Int.graphql_name().to_string(),
count_scalar_type: BsonScalarType::Int.graphql_name().into(),
}),
}),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ pub fn plan_for_grouping<T: QueryContext>(
})
.collect::<Result<_>>()?;

let aggregates = plan_for_aggregates(
plan_state,
collection_object_type,
grouping
.aggregates
.into_iter()
.map(|(key, aggregate)| (key.into(), aggregate))
.collect(),
)?;
let aggregates = plan_for_aggregates(plan_state, collection_object_type, grouping.aggregates)?;

let predicate = grouping
.predicate
Expand Down Expand Up @@ -72,6 +64,7 @@ fn plan_for_dimension<T: QueryContext>(
column_name,
arguments,
field_path,
..
} => {
let (relationship_path, collection_type) = plan_for_relationship_path(
plan_state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ fn scalar_types() -> BTreeMap<String, ndc::ScalarType> {
ndc::ComparisonOperatorDefinition::Equal,
)]
.into(),
extraction_functions: Default::default(),
},
),
(
Expand All @@ -211,6 +212,7 @@ fn scalar_types() -> BTreeMap<String, ndc::ScalarType> {
ndc::ComparisonOperatorDefinition::Equal,
)]
.into(),
extraction_functions: Default::default(),
},
),
(
Expand All @@ -231,6 +233,7 @@ fn scalar_types() -> BTreeMap<String, ndc::ScalarType> {
),
]
.into(),
extraction_functions: Default::default(),
},
),
]
Expand Down
5 changes: 3 additions & 2 deletions crates/ndc-test-helpers/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::column::Column;
#[derive(Clone, Debug, Default)]
pub struct GroupingBuilder {
dimensions: Vec<Dimension>,
aggregates: IndexMap<String, Aggregate>,
aggregates: IndexMap<FieldName, Aggregate>,
predicate: Option<GroupExpression>,
order_by: Option<GroupOrderBy>,
limit: Option<u32>,
Expand All @@ -33,7 +33,7 @@ impl GroupingBuilder {

pub fn aggregates(
mut self,
aggregates: impl IntoIterator<Item = (impl Into<String>, impl Into<Aggregate>)>,
aggregates: impl IntoIterator<Item = (impl Into<FieldName>, impl Into<Aggregate>)>,
) -> Self {
self.aggregates = aggregates
.into_iter()
Expand Down Expand Up @@ -127,6 +127,7 @@ impl From<DimensionColumnBuilder> for Dimension {
column_name: value.column_name,
arguments: value.arguments,
field_path: value.field_path,
extraction: None,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/ndc-test-helpers/src/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ pub fn row_set() -> RowSetBuilder {

pub fn group(
dimensions: impl IntoIterator<Item = impl Into<serde_json::Value>>,
aggregates: impl IntoIterator<Item = (impl ToString, impl Into<serde_json::Value>)>,
aggregates: impl IntoIterator<Item = (impl Into<FieldName>, impl Into<serde_json::Value>)>,
) -> Group {
Group {
dimensions: dimensions.into_iter().map(Into::into).collect(),
aggregates: aggregates
.into_iter()
.map(|(name, value)| (name.to_string(), value.into()))
.map(|(name, value)| (name.into(), value.into()))
.collect(),
}
}
Loading