1. 04 11月, 2020 1 次提交
  2. 23 10月, 2020 1 次提交
    • J
      Modernize: use equals-default and equals-delete · 9f2e9344
      Jesse Zhang 提交于
      This commit replaces two pre-C++ 11 practices with their modern, more
      intent-expressive equivalents: "disallowed" copy and assignments, and
      pairs of empty braces for special member function (destructors, default
      constructors, and etc) bodies.
      
      "Disallowed" copy constructors / assignment
      -------------------------------------------
      Old: private, unimplemented copy constructors and copy-assignment
      operators in classes. These are usually paired with a semi-descriptive
      comment.
      
      New: publicly declare them as "= delete".
      
      Fun fact: we had 13 spellings in comments on disallowed copy
      constructors:
      
      01. disable copy ctor
      02. hidden copy ctor
      03. inaccessible copy ctor
      04. no copy ctor
      05. no default copy ctor
      06. private copy ctor
      07. private no copy ctor
      08. disabled copy constructor
      09. no copy constructor
      10. private copy constructor
      11. copy c'tor - not defined
      12. no copy c'tor
      13. private copy c'tor
      
      This commit removes all of them, because the new code ("~T() = delete")
      already clearly expresses the intent of disallowing copy and assignment.
      
      To keep the history clear, this commit leaves the declaration of
      "prohibited" functions private. A forthcoming commit will wholesale
      change them to public.
      
      Defaulted special member functions
      ----------------------------------
      Old:
      struct A {
        A() {}
        ~A();
      };
      A::~A() {}
      
      New:
      struct A {
        A() = default;
        ~A();
      };
      A::~A() = default;
      
      Replacing empty braces with defaulting not only makes them more clear,
      they also enable more opportunities in compiler optimizations, as e.g.
      some defaulted functions might be recognized as trivial.
      
      Most of this commit is produced by running clang-tidy with an invocation
      like the following (plus some CMake and shell tricks):
      
      clang-tidy-12 -header-filter 'gpdbcost|gpopt|gpos|naucrates' -checks '-*,modernize-use-equals-delete,modernize-use-equals-default'
      
      The tool uses a slightly conservative heuristic to detect a large
      portion of the two outdated patterns above and rewrite them into using
      "= delete" and "= default". Making the "= delete" functions public, is
      sadly a FIXME item, so we'll have to do it by hand (in a forthcoming
      commit).
      9f2e9344
  3. 23 9月, 2020 1 次提交
    • J
      Format ORCA and GPOPT. · 2f7dd76c
      Jesse Zhang 提交于
      The canonical config file is in src/backend/gporca/.clang-format, I've
      created two symlinks, one for GPOPT headers, one for GPOPT.
      2f7dd76c
  4. 03 6月, 2020 1 次提交
    • H
      Refactoring the DbgPrint and OsPrint methods (#10149) · b3fdede6
      Hans Zeller 提交于
      * Make DbgPrint and OsPrint methods on CRefCount
      
      Create a single DbgPrint() method on the CRefCount class. Also create
      a virtual OsPrint() method, making some objects derived from CRefCount
      easier to print from the debugger.
      
      Note that not all the OsPrint methods had the same signatures, some
      additional OsPrintxxx() methods have been generated for that.
      
      * Making print output easier to read, print some stuff on demand
      
      Required columns in required plan properties are always the same
      for a given group. Also, equivalent expressions in required distribution
      properties are important in certain cases, but in most cases they
      disrupt the display and make it harder to read.
      
      Added two traceflags, EopttracePrintRequiredColumns and
      EopttracePrintEquivDistrSpecs that have to be set to print this
      information. If you want to go back to the old display, use these
      options when running gporca_test: -T 101016 -T 101017
      
      * Add support for printing alternative plans
      
      A new method, CEngine::DbgPrintExpr() can be called from
      COptimizer::PexprOptimize, to allow printing of the best plan
      for different contexts. This is only enabled in debug builds.
      
      To use this:
      
      - run an MDP using gporca_test, using a debug build
      - print out memo after optimization (-T 101006 -T 101010)
      - set a breakpoint near the end of COptimizer::PexprOptimize()
      - if, after looking at the contents of memo, you want to see
        the optimal plan for context c of group g, do the following:
        p eng.DbgPrintExpr(g, c)
      
      You could also get the same info from the memo printout, but it
      would take a lot longer.
      b3fdede6