yql_expr_csee.h 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include "yql_graph_transformer.h"
  3. #include "yql_type_annotation.h"
  4. #include <util/digest/murmur.h>
  5. namespace NYql {
  6. IGraphTransformer::TStatus EliminateCommonSubExpressions(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx,
  7. bool forSubGraph, const TColumnOrderStorage& coStore);
  8. IGraphTransformer::TStatus UpdateCompletness(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx);
  9. // Calculate order between two given nodes. Must be used only after CSEE pass or UpdateCompletness.
  10. // 0 may not mean equality of nodes because we cannot distinguish order of external arguments in some cases.
  11. int CompareNodes(const TExprNode& left, const TExprNode& right);
  12. inline ui64 CseeHash(const void* data, size_t size, ui64 initHash) {
  13. return MurmurHash<ui64>(data, size, initHash);
  14. }
  15. template<typename T, std::enable_if_t<std::is_integral<T>::value>* = nullptr>
  16. inline ui64 CseeHash(T value, ui64 initHash) {
  17. // workaround Coverity warning for Murmur when sizeof(T) < 8
  18. ui64 val = static_cast<ui64>(value);
  19. return MurmurHash<ui64>(&val, sizeof(val), initHash);
  20. }
  21. }