mirror of
https://github.com/MariaDB/server.git
synced 2025-11-08 00:28:29 +03:00
Analysis: So, there were two problems that needed to be fixed. 1) To fix the crash. 2) After fixing the crash, the result was wrong. Reason for crash: When we pass the hash to get_intersect_between_arrays(), We were initialially not passing it value, so the operations were not performed correctly. Reason for wrong result: The number of rows that it was returning were same as that in the table, but, only the first row had correct ouput, rest of them were NULL (it should also be the result of interection). This was because we modified the "items" HASH by deleting the "seen" elements. So for next rows, it did not have the elements it should have in the hash. Fix: 1) To fix the crash: pass the HASH by reference 2) To fix incorrect result: Maintain a separate "seen" hash, if an item is found the the "items" hash, delete it ony temporarily and put it in the seen hash. At then end, put the items from "seen" back into "items" and reset "seen".
151 KiB
151 KiB