1. 29 9月, 2020 1 次提交
    • J
      Format ORCA and GPOPT. · 219fe0c4
      Jesse Zhang 提交于
      The canonical config file is in src/backend/gpopt/.clang-format (instead
      of under the non-existent src/backend/gporca), I've created one (instead
      of two) symlink, for GPOPT headers. Care has been taken to repoint the
      symlink to the canonical config under gpopt, instead of gpopt as it is
      under HEAD.
      
      This is spiritually a cherry-pick of commit 2f7dd76c.
      (cherry picked from commit 2f7dd76c)
      219fe0c4
  2. 01 6月, 2019 1 次提交
  3. 16 8月, 2018 1 次提交
  4. 15 2月, 2018 1 次提交
    • J
      Add type modifiers (typmod) support to ORCA · 1c37d8af
      Jesse Zhang 提交于
      ORCA has historically ignored type modifiers from databases that support
      them, noticeably Postgres and Greenplum. This has led to surprises in a
      few cases:
      
      1. The output description over the wire (for Postgres protocol) will
      lose the type modifier information, which often meant length. This
      surprises code that expects a non-default type modifier, e.g. a JDBC
      driver.
      
      2. The executor in some cases -- notably DML -- expects a precise type
      modifier. Because ORCA always erases the type modifiers and presents a
      default, the executor is forced to find that information elsewhere.
      
      After this commit, ORCA will be aware of type modifiers in table
      columns, scalar identifiers, constants, and length-coercion casts.
      Signed-off-by: NShreedhar Hardikar <shardikar@pivotal.io>
      (cherry picked from commit 2d907526)
      1c37d8af
  5. 09 1月, 2018 1 次提交
  6. 15 7月, 2017 1 次提交
    • H
      Remove PartOidExpr, it's not used in GPDB. (#2481) · 941327cd
      Heikki Linnakangas 提交于
      * Remove PartOidExpr, it's not used in GPDB.
      
      The target lists of DML nodes that ORCA generates includes a column for the
      target partition OID. It can then be referenced by PartOidExprs. ORCA uses
      these to allow sorting the tuples by partition, before inserting them to the
      underlying table. That feature is used by HAWQ, where grouping tuples that
      go to the same output partition is cheaper.
      
      Since commit adfad608, which removed the gp_parquet_insert_sort GUC, we
      don't do that in GPDB, however. GPDB can hold multiple result relations open
      at the same time, so there is no performance benefit to grouping the tuples
      first (or at least not enough benefit to counterbalance the cost of a sort).
      
      So remove the now unused support for PartOidExpr in the executor.
      
      * Bump ORCA version to 2.37
      Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
      
      * Removed acceptedLeaf
      Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
      941327cd
  7. 12 4月, 2017 1 次提交
  8. 04 4月, 2017 1 次提交
    • H
      Fix duplicate typedefs. · 615b4c69
      Heikki Linnakangas 提交于
      It's an error in standard C - at least in older standards - to typedef
      the same type more than once, even if the definition is the same. Newer
      versions of gcc don't complain about it, but you can see the warnings
      with -pedantic (among a ton of other warnings, search for "redefinition").
      
      To fix, remove the duplicate typedefs. The ones in src/backend/gpopt and
      src/include/gpopt were actually OK, because a duplicate typedef is OK in
      C++, and those files are compiled with a C++ compiler. But many of the
      typedefs in those files were not used for anything, so I nevertheless
      removed duplicate ones there too, that caught my eye.
      
      In gpmon.h, we were redefining apr_*_t types when postgres.h had been
      included. But as far as I can tell, that was always - all the files that
      included gpmon, included postgres.h directly or indirectly before that.
      Search & replace the references to apr_*_t types in that file with the
      postgres equivalents, to make it more clear what they actually are.
      615b4c69
  9. 01 4月, 2017 1 次提交
    • F
      Rule based partition selection for list (sub)partitions (#2076) · 5cecfcd1
      foyzur 提交于
      GPDB supports range and list partitions. Range partitions are represented as a set of rules. Each rule defines the boundaries of a part. E.g., a rule might say that a part contains all values between (0, 5], where left bound is 0 exclusive, but the right bound is 5, inclusive. List partitions are defined by a list of values that the part will contain. 
      
      ORCA uses the above rule definition to generate expressions that determine which partitions need to be scanned. These expressions are of the following types:
      
      1. Equality predicate as in PartitionSelectorState->levelEqExpressions: If we have a simple equality on partitioning key (e.g., part_key = 1).
      
      2. General predicate as in PartitionSelectorState->levelExpressions: If we need more complex composition, including non-equality such as part_key > 1.
      
      Note:  We also have residual predicate, which the optimizer currently doesn't use. We are planning to remove this dead code soon.
      
      Prior to  this PR, ORCA was treating both range and list partitions as range partitions. This meant that each list part will be converted to a set of list values and each of these values will become a single point range partition.
      
      E.g., consider the DDL:
      
      ```sql
      CREATE TABLE DATE_PARTS (id int, year int, month int, day int, region text)
      DISTRIBUTED BY (id)
      PARTITION BY RANGE (year)
          SUBPARTITION BY LIST (month)
             SUBPARTITION TEMPLATE (
              SUBPARTITION Q1 VALUES (1, 2, 3), 
              SUBPARTITION Q2 VALUES (4 ,5 ,6),
              SUBPARTITION Q3 VALUES (7, 8, 9),
              SUBPARTITION Q4 VALUES (10, 11, 12),
              DEFAULT SUBPARTITION other_months )
      ( START (2002) END (2012) EVERY (1), 
        DEFAULT PARTITION outlying_years );
      ```
      
      Here we partition the months as list partition using quarters. So, each of the list part will contain three months. Now consider a query on this table:
      
      ```sql
      select * from DATE_PARTS where month between 1 and 3;
      ```
      
      Prior to this ORCA generated plan would consider each value of the Q1 as a separate range part with just one point range. I.e., we will have 3 virtual parts to evaluate for just one Q1: [1], [2], [3]. This approach is inefficient. The problem is further exacerbated when we have multi-level partitioning. Consider the list part of the above example. We have only 4 rules for 4 different quarters, but we will have 12 different virtual rule (aka constraints). For each such constraint, we will then evaluate the entire subtree of partitions.
      
      After this PR, we no longer decompose rules into constraints for list parts and then derive single point virtual range partitions based on those constraints. Rather, the new ORCA changes will use ScalarArrayOp to express selectivity on a list of values. So, the expression for the above SQL will look like 1 <= ANY {month_part} AND 3 >= ANY {month_part}, where month_part will be substituted at runtime with different list of values for each of quarterly partitions. We will end up evaluating that expressions 4 times with the following list of values:
      
      Q1: 1 <= ANY {1,2,3} AND 3 >= ANY {1,2,3}
      Q2: 1 <= ANY {4,5,6} AND 3 >= ANY {4,5,6}
      ...
      
      Compare this to the previous approach, where we will end up evaluating 12 different expressions, each time for a single point value:
      
      First constraint of Q1: 1 <= 1 AND 3 >= 1
      Second constraint of Q1: 1 <= 2 AND 3 >= 2
      Third constraint of Q1: 1 <= 3 AND 3 >= 3
      First constraint of Q2: 1 <= 4 AND 3 >= 4
      ...
      
      The ScalarArrayOp depends on a new type of expression PartListRuleExpr that can convert a list rule to an array of values. ORCA specific changes can be found here: https://github.com/greenplum-db/gporca/pull/149
      5cecfcd1
  10. 21 1月, 2017 1 次提交
  11. 15 6月, 2016 1 次提交
  12. 18 5月, 2016 1 次提交
  13. 24 11月, 2015 1 次提交
  14. 28 10月, 2015 1 次提交