Skip to content

Conversation

@Aniruddh25
Copy link
Collaborator

@Aniruddh25 Aniruddh25 commented Nov 8, 2022

Why make this change?

What is this change?

How was this tested?

  • Running the equivalent queries and gathering actual execution plans.

To Do

Investigate similar queries for PgSql, MySql

Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just had one question about pagination.

Copy link
Contributor

@ayush3797 ayush3797 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! LGTM!

@Aniruddh25 Aniruddh25 enabled auto-merge (squash) November 11, 2022 23:18
@Aniruddh25 Aniruddh25 disabled auto-merge November 12, 2022 00:39
@Aniruddh25 Aniruddh25 enabled auto-merge (squash) November 12, 2022 00:44
Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Aniruddh25 Aniruddh25 merged commit c4f7ff9 into main Nov 12, 2022
@Aniruddh25 Aniruddh25 deleted the dev/anmunde/nestedFilterDesign branch November 12, 2022 00:57
Aniruddh25 added a commit that referenced this pull request Nov 17, 2022
…#975)

## Why make this change?

- This is a precursor to #825 the design for which is discussed in #957. 
- It is purely a refactor necessary to write a recursive graphql filter parser for SQL.

## What is this change?

- Although many files seem to be changed, main file to focus on is `GQLFilterParser`.
- Change the input arguments for `GQLFilterParser`.`Parse` to include a `BaseQueryStructure` so that it can be called recursively for nested filters both for SQL and Cosmos. Currently, used only for `Cosmos` by setting the `DatabaseObject.Name` to `parentSourceName.NestedFilterFieldname` before each recursive call. Eventually resetting to `_containerAlias` once back to the first caller in `CosmosQueryEngine`
- With this modification, moved some of the properties from `BaseSqlQueryStructure` to the base class `BaseQueryStructure` which are useful for Cosmos too : 
     + `EntityName` = the entity name from the config,
     + `SourceAlias` = the alias of the main entity being filtered used in the query that's generated (renamed from `TableAlias`). Is the `containerAlias` on the first instance of the call for Cosmos.
     + `MetadataProvider` = either the Sql or Cosmos metadata provider (renamed from `SqlMetadataProvider`)
     + `DatabaseObject` = has the schema name and source name
     +  `AuthorizationResolver` = useful to add DbPolicyPredicates for any of the entities used in the nested filter
- Make `GQLFilterParser` a singleton service dependent on `ISqlMetadataProvider` since we will (in a future PR) use the information from the `MetadataProvider` to obtain `DatabaseObject` of the nested entity.
- Constructor modifications to trickle the `GQLFilterParser` and `AuthorizationResolver` to the `BaseQueryStructure`

## How was this tested?

- Existing tests since this is only a refactor, no change in functionality.
@Aniruddh25 Aniruddh25 linked an issue Nov 17, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design Nesting Filtering for SQL Cannot filter using fields in relationship

5 participants