mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
1564fcce17
This PR removes the usage of `ndc_models` `Expression` types from the IR. It then adds logic to map from the new IR `FilterExpression` types to `ndc_models` types in the plan part of the code where IR -> ndc_models mapping is performed. The new IR types and the change to the IR creation logic is mostly in `crates/execute/src/ir/filter.rs`. The new IR types have some optimisations applied to them. In particular, some basic boolean expression simplification logic is applied when `FilterExpression::mk_and` `mk_or` and `mk_not` are used. This strips out redundant and/ors/nots resulting in simpler boolexps for connectors to process. (This logic is similar to what GDC did in Hasura v2). Unfortunately it turned out that arguments had JSON-serialized `ndc_models` types embedded in them, in particular, where argument presets had been used to set a BooleanExpression as an argument value. The old code was simply creating an ndc_models::Expression and serializing it directly to JSON. This has now been refactored to retain the new IR `FilterExpression` until `plan` time, at which point it will be mapped into the ndc type and serialized to JSON and embedded in the argument value. The types change for this can be seen in `crates/execute/src/ir/arguments.rs`, but the real logic is actually in `crates/execute/src/ir/permissions.rs`, with the `make_value_from_value_expression` and `make_argument_from_value_expression` functions. The mapping of expression and argument IR into `ndc_models` can be found in `crates/execute/src/plan/common.rs`. In `metadata_resolve`, some ndc_models types were removed and non-ndc_model types were used instead. In particular `ndc_models::ComparisonOperatorName` (swapped with `DataConnectorOperatorName`) and `ndc_models::UnaryComparisonOperator` (swapped with a new `UnaryComparisonOperator` enum type). This PR is a functional no-op, other than the boolean expression simplification. V3_GIT_ORIGIN_REV_ID: 13805430fb2e2ca5653406a094d719138f0d5b51 |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
Cargo.toml | ||
readme.md |
execute
Given an already resolved set of metadata, this crate is responsible for taking requests and executing them.