[CALCITE-3744] Duplicate rule matches when RelSet gets merged

Some times RelSet can get merged. e.g.

Each number represet Rel id, and they are in different RelSet.

 1            4
   \         /
     2      /
       \   /
         3
Assume in the rulequeue, we have rule match with name of 12, 23, 43. For
simplicity, omit the rule name, first digit represent the parent RelNode,
second represent the child.

If after some rule, we merged the set of 3 into the set of 2, and RelNode 4's
input is replaced by RelSubset of 2. We will retrigger rules and try to add
rulematch 12, 42, 43 into rule queue.

12 will be filtered out, because there is duplicate in the RuleMatch names set.
But for 43, it now has different rulematch digest with previous match, because
RelNode #4's input RelSubset changed, its digest also changed. So we can't
detect the duplication and will re-apply rulematch 43 twice.
2 files changed
tree: 561802a97903370f8c43e863494f442af2215058
  1. .github/
  2. babel/
  3. bom/
  4. buildSrc/
  5. cassandra/
  6. core/
  7. druid/
  8. elasticsearch/
  9. example/
  10. file/
  11. geode/
  12. gradle/
  13. kafka/
  14. linq4j/
  15. mongodb/
  16. pig/
  17. piglet/
  18. plus/
  19. redis/
  20. release/
  21. server/
  22. site/
  23. spark/
  24. splunk/
  25. src/
  26. ubenchmark/
  27. .editorconfig
  28. .gitattributes
  29. .gitignore
  30. .ratignore
  31. .travis.yml
  32. appveyor.yml
  33. build.gradle.kts
  34. gradle.properties
  35. gradlew
  36. gradlew.bat
  37. LICENSE
  38. NOTICE
  39. README
  40. README.md
  41. settings.gradle.kts
  42. sqlline
  43. sqlline.bat
  44. sqlsh
  45. sqlsh.bat
README.md

Travis Build Status CI Status AppVeyor Build Status

Apache Calcite

Apache Calcite is a dynamic data management framework.

It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.

For more details, see the home page.