| 485 | } |
| 486 | |
| 487 | bool mapEqual(const ValueExprNode* field1, const ValueExprNode* field2, const MapNode* map) |
| 488 | { |
| 489 | // Test to see if two fields are equal, where the fields are in two different streams |
| 490 | // possibly mapped to each other. Order of the input fields is important. |
| 491 | const auto fieldNode1 = nodeAs<FieldNode>(field1); |
| 492 | const auto fieldNode2 = nodeAs<FieldNode>(field2); |
| 493 | |
| 494 | if (!fieldNode1 || !fieldNode2) |
| 495 | return false; |
| 496 | |
| 497 | // look through the mapping and see if we can find an equivalence. |
| 498 | auto sourcePtr = map->sourceList.begin(); |
| 499 | auto targetPtr = map->targetList.begin(); |
| 500 | |
| 501 | for (const auto sourceEnd = map->sourceList.end(); |
| 502 | sourcePtr != sourceEnd; |
| 503 | ++sourcePtr, ++targetPtr) |
| 504 | { |
| 505 | const auto mapFrom = nodeAs<FieldNode>(*sourcePtr); |
| 506 | const auto mapTo = nodeAs<FieldNode>(*targetPtr); |
| 507 | |
| 508 | if (!mapFrom || !mapTo) |
| 509 | continue; |
| 510 | |
| 511 | if (fieldNode1->fieldStream != mapFrom->fieldStream || |
| 512 | fieldNode1->fieldId != mapFrom->fieldId) |
| 513 | { |
| 514 | continue; |
| 515 | } |
| 516 | |
| 517 | if (fieldNode2->fieldStream != mapTo->fieldStream || |
| 518 | fieldNode2->fieldId != mapTo->fieldId) |
| 519 | { |
| 520 | continue; |
| 521 | } |
| 522 | |
| 523 | return true; |
| 524 | } |
| 525 | |
| 526 | return false; |
| 527 | } |
| 528 | |
| 529 | void setDirection(SortNode* fromClause, SortNode* toClause) |
| 530 | { |
no test coverage detected