-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Forwardport] Ensure integer values are not quoted as strings #18961
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
[Forwardport] Ensure integer values are not quoted as strings #18961
Conversation
Hi @gelanivishal. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
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.
The lines are now longer than 80 chars and readability is partly worse now.
Also int typecasting is faster than intval.
@@ -284,8 +284,8 @@ public function update() | |||
|
|||
for ($vsFrom = $lastVersionId; $vsFrom < $currentVersionId; $vsFrom += $versionBatchSize) { | |||
// Don't go past the current version for atomicy. | |||
$versionTo = min($currentVersionId, $vsFrom + $versionBatchSize); | |||
$ids = array_map('intval', $this->getChangelog()->getList($vsFrom, $versionTo)); | |||
$versionTo = min($currentVersionId, $versionFrom + $versionBatchSize); |
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.
Looks like $versionFrom
is not defined there. Please fix it.
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.
@ihor-sviziev Done.
'intval', | ||
$this->productResource->getConnection()->fetchCol($unionSelect) | ||
); | ||
$this->categoryIdList[$productId] = array_map('intval', $this->productResource->getConnection()->fetchCol($unionSelect)); |
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.
Previously code was the same as in 2.2-develop, so it's better to keep it as it was before. Please revert this change
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.
@ihor-sviziev Done.
@ihor-sviziev I have performed your requested changes. |
Reverted? Does not seem so: https://github.com/magento/magento2/pull/18961/files |
@DanielRuf Check now. |
@@ -2021,11 +2021,7 @@ protected function _applyProductLimitations() | |||
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id'], 'int'), | |||
]; | |||
if (isset($filters['visibility']) && !isset($filters['store_table'])) { | |||
$conditions[] = $this->getConnection()->quoteInto( |
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.
Still not reverted here, please use the more readable version with multiple lines
In sum, there is currently no |
@gelanivishal please fix this PR branch using force push so that it contains only two commits exactly as https://github.com/magento/magento2/pull/18287/commits preserving original authors. Otherwise we will have to reject such forwardport. |
Original Pull Request
#18287
Description
In cases where indexers does a filtering in the style of
WHERE entity_id IN (...)
there is a performance penalty if IDs are passed as strings, rather than integer values. This is especially visible on larger data sets. This pull request should cover some common occurrences of this.Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist