-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add transform test for query plan #630
Conversation
I think it may have hurt to expand this test. It maybe caused this Release failure (NBD, but inconvenient). I find the Maybe if we touch anything here, we should refactor this first, to find another way to avoid this diff issue. Maybe we should just sort these arrays before printing them? |
Maybe the results could be sorted before they're serialized to JSON with |
Since snapshots include query references and query plan references, and since those can be orderered nondeterministically, the test can fail if the snapshot is built with fields in an unexpected order. The existing test tries to account for that by enumerating all possible combinations, but this is very difficult to maintain, and very difficult to scale to additional fields with this pattern. Instead, rewrite snapshots to a canonical format to ensure comparisons are stable. We can't just sort the array fields before serializing the snapshot for comparison, since QueryReferences and similar items are referenced by an index into their array. To work around that, we sort the QueryReferences (tracking their original index), and rewrite all entries that reference them to reference their new index instead. See discussion in #630 [1]. [1]: #630 (comment)
Since snapshots include query references and query plan references, and since those can be orderered nondeterministically, the test can fail if the snapshot is built with fields in an unexpected order. The existing test tries to account for that by enumerating all possible combinations, but this is very difficult to maintain, and very difficult to scale to additional fields with this pattern. Instead, rewrite snapshots to a canonical format to ensure comparisons are stable. We can't just sort the array fields before serializing the snapshot for comparison, since QueryReferences and similar items are referenced by an index into their array. To work around that, we sort the QueryReferences (tracking their original index), and rewrite all entries that reference them to reference their new index instead. See discussion in #630 [1]. [1]: #630 (comment)
Follow-up of #624
While debugging some issue, I noticed that this test exist. To isolate the issue, I started adding the test. While it turned out not to be the collector side issue, I think it won't hurt to expand this test.