This PR is created to fix the correctness issue related to shared path prefix. The code wasn't properly sharing path for the request to fetch the facets (#896 ).
Examples
To make this easier to understand, assume the following ERD with the following source definitions on table schema:main:
The existing code was adding a new join statement from table main to C while the new code will make sure it's using the table instance that is already created. Also what's special in this case is the alias M. Alias M is documented as the alias that is used for the projected result and that's why the new code is ensuring a new alias is not created and we're using the M alias.
Further changes
These request can can be optimized by removing the path reset ($T) that are added after each facet, but that should be part of another PR as it will cause other issues (it will also require a lot of changes in tests).
Description
This PR is created to fix the correctness issue related to shared path prefix. The code wasn't properly sharing path for the request to fetch the facets (#896 ).
Examples
To make this easier to understand, assume the following ERD with the following source definitions on table
schema:main
:Example 1
Navigating to a
schema:main
page with the following facet blob:Should result in the following main request:
And the following request for facet B:
The existing code was adding a new join statement from table
main
toA
for the path frommain
toB
.Example 2
The changes in this PR also handle the cases where a facet is superset of the other ones. For example:
Which will result in the following request for the main table:
And the following request for first facet (
A
):The existing code was adding a new join statement from table
main
toC
while the new code will make sure it's using the table instance that is already created. Also what's special in this case is the aliasM
. AliasM
is documented as the alias that is used for the projected result and that's why the new code is ensuring a new alias is not created and we're using theM
alias.Further changes
These request can can be optimized by removing the path reset (
$T
) that are added after each facet, but that should be part of another PR as it will cause other issues (it will also require a lot of changes in tests).