Skip to content

Disabled flat: cast $attributeId as (int) in selects #26790

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

Merged

Conversation

ilnytskyi
Copy link
Contributor

Description (*)

When we disabled flat we noticed that ids are cast as string

SELECT `t_d`.`attribute_id`, `e`.`entity_id`
FROM `catalog_product_entity_varchar` AS `t_d`
         INNER JOIN `catalog_product_entity` AS `e` ON e.entity_id = t_d.entity_id
         LEFT JOIN `catalog_product_entity_varchar` AS `t_s`
                   ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 8
WHERE (e.entity_id IN
       (209884, 213420, 212364, 212009, 211989, 211710, 210914, 210588, 212316, 212239, 210456, 210453, 213157, 212556,
        212380, 211186, 210984, 210157, 209443, 208989, 169036, 168488, 158426, 211496, 209688, 210951, 203816, 206125,
        203077, 158390, 158397, 158402, 206534, 143843, 149488, 149470, 200116, 193494, 193134, 208259, 151009, 213770,
        213759, 213751, 213735, 213731, 213721, 213270, 212975, 212948, 212917, 212865, 212753, 212729, 212655, 212541))
  AND (t_d.attribute_id IN
       ('73', '87', '88', '89', '109', '110', '111', '119', '122', '133', '148', '177', '180', '184', '210', '220',
        '222'))
  AND (t_d.store_id = IFNULL(t_s.store_id, 0));

this fix will change it to be cast like numbers

SELECT `t_d`.`attribute_id`, `e`.`entity_id`
FROM `catalog_product_entity_varchar` AS `t_d`
         INNER JOIN `catalog_product_entity` AS `e` ON e.entity_id = t_d.entity_id
         LEFT JOIN `catalog_product_entity_varchar` AS `t_s`
                   ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 8
WHERE (e.entity_id IN
       (209884, 213420, 212364, 212009, 211989, 211710, 210914, 210588, 212316, 212239, 210456, 210453, 213157, 212556,
        212380, 211186, 210984, 210157, 209443, 208989, 169036, 168488, 158426, 211496, 209688, 210951, 203816, 206125,
        203077, 158390, 158397, 158402, 206534, 143843, 149488, 149470, 200116, 193494, 193134, 208259, 151009, 213770,
        213759, 213751, 213735, 213731, 213721, 213270, 212975, 212948, 212917, 212865, 212753, 212729, 212655, 212541))
  AND (t_d.attribute_id IN (73, 87, 88, 89, 109, 110, 111, 119, 122, 133, 148, 177, 180, 184, 210, 220, 222))
  AND (t_d.store_id = IFNULL(t_s.store_id, 0));

Related Pull Requests

Fixed Issues (if relevant)

  1. magento/magento2#<issue_number>: Issue title

Manual testing scenarios (*)

  1. See selects generated in \Magento\Eav\Model\Entity\Collection\AbstractCollection::_loadAttributes method

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Feb 10, 2020

Hi @ilnytskyi. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

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

Hi @ilnytskyi. Thank you for your collaboration. Could you take a look at the failing tests, please?

Also, according to the new Definition of Done all changes should be covered by auto-tests. In this particular case, I would suggest extending the existing unit test.

Thank you.

@rogyar rogyar added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Feb 10, 2020
@ilnytskyi ilnytskyi force-pushed the disable-flat-eav-int-select branch from 8f66966 to 2397bec Compare February 10, 2020 20:31
@ilnytskyi ilnytskyi requested a review from rogyar February 11, 2020 09:07
@ilnytskyi
Copy link
Contributor Author

@rogyar added a test
B2B and EE tests seem to be falling due to problems not related to current cahnges.

@ilnytskyi ilnytskyi removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Progress: needs update labels Feb 12, 2020
@ghost
Copy link

ghost commented Feb 12, 2020

@ilnytskyi unfortunately, only members of the maintainers team are allowed to remove progress related labels to the pull request

@rogyar rogyar added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Feb 15, 2020
@rogyar
Copy link
Contributor

rogyar commented Feb 15, 2020

Awesome, thank you

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-6908 has been created to process this Pull Request

@engcom-Delta
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Feb 21, 2020

Hi @ilnytskyi, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Eav Progress: accept Release Line: 2.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants