Skip to content
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

support mapping relations to classes #3306

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gs-rpant1729
Copy link
Contributor

@gs-rpant1729 gs-rpant1729 commented Dec 14, 2024

What type of PR is this?

Improvement

What does this PR do / why is it needed ?

Introduce new SetImplementation to support mapping functions returning Relations to Classes.

Which issue(s) this PR fixes:

Fixes #

Other notes for reviewers:

Does this PR introduce a user-facing change?

Comment on lines +185 to +188
tacn: TableAliasColumnName[1]| let new = $m->get($tacn.alias.name);
assertNotEmpty($new);
let alias = $tacn.alias;
^$tacn(alias = ^$alias(name=$new->toOne()));,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is purely for a bug fix (see fixed PCT tests). I don't use TableAliasColumnName anywhere. Encountered this bug while running some queries during development.

);
}

function meta::pure::router::store::routing::byPassClusteringInfo(value:Any[1]):Any[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -34,7 +37,17 @@ import meta::pure::store::*;
// =========================================================================================
function meta::pure::router::store::routing::getRoutingStrategyFromMappingAndRuntime(mapping:Mapping[1], runtime:Runtime[1]):StoreMappingRoutingStrategy[1]
{
getRoutingStrategyFromMappingAndRuntime($mapping, $runtime, []);
^StoreMappingRoutingStrategy(
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this changing functionality? Previously it would have gone to function below to help with model joins based on runtime locality

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the function was unused before, I repurposed it to return just the strategy object. Both usages of this function are in the same file, the overloaded version of the function (with extensions param) is the one used externally. Have made this function private to avoid incorrect usage.

@@ -7621,7 +7651,7 @@ function meta::relational::functions::pureToSqlQuery::addExtraJoinColumns(tableA
let joinTableAliasColumns = $j.operation->extractTableAliasColumns()->filter(c|$c.alias==$tableAlias)->removeDuplicates();
let updatedRelationalElement = $tableAlias.relationalElement->match([s:SelectSQLQuery[1] | let existingCols = $s.columns->map(col| $col->match([tac:TableAliasColumn[1] | $tac.column.name,
a:Alias[1] | $a.name
]));
])->stripMatchingQuotes());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should discuss on quotes and TableAliasColumnName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

Test Results

  1 017 files    1 017 suites   1h 43m 9s ⏱️
12 811 tests 12 702 ✔️ 109 💤 0
18 815 runs  18 706 ✔️ 109 💤 0

Results for commit ac28a57.

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.

2 participants