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
Make join table sort stable #13025
Make join table sort stable #13025
Conversation
Looks like some other tests need to be updated. |
'tableAlias' => 'log_action_idaction_name', | ||
'joinOn' => 'log_link_visit_action.idaction_name = log_action_idaction_name.idaction', | ||
'tableAlias' => 'log_action_visit_exit_idaction_name', | ||
'joinOn' => 'log_visit.visit_exit_idaction_name = log_action_visit_exit_idaction_name.idaction', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This test is actually slightly buggy because the query would never work as it references a log_visit
table which is never added. I presume it needs to be log_link_visit_action
instead.
dbd0801
to
9439a17
Compare
Still some failures in integration tests. Seems the join generator results in an invalid query? |
I realised that using I think we need to implement a topological sort. |
@@ -286,15 +286,15 @@ public function sortTablesForJoin($tA, $tB) | |||
$tBName = $tB['table']; | |||
} | |||
|
|||
if ($tBName && isset($tA['joinOn']) && strpos($tA['joinOn'], $tBName) !== false) { | |||
if ($tBName && isset($tA['joinOn']) && strpos($tA['joinOn'] . '.', $tBName) !== false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this dot .
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this in case there is like a table log_action
and log_action_foo
maybe?
closing in favor of #13634 |
As discussed in #12778, the table sort in
Piwik\DataAccess\LogQueryBuilder\JoinGenerator
should be stable for more reliable testing.In case the order of two joins is irrelevant, they are now sorted by the table alias which should be unique. This makes the sorting identical in PHP 5 and PHP 7.