Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-21818

CBO: Copying TableRelOptHiveTable has metastore traffic

    XMLWordPrintableJSON

Details

    Description

      While the optimizer is running, whenever it makes a copy of the TableScan to perform potential rewrites, there is Hive metastore traffic from inside CBO optimizer.

        public RelOptHiveTable(RelOptSchema calciteSchema, RelDataTypeFactory typeFactory, List<String> qualifiedTblName,
            RelDataType rowType, Table hiveTblMetadata, List<ColumnInfo> hiveNonPartitionCols,
            List<ColumnInfo> hivePartitionCols, List<VirtualColumn> hiveVirtualCols, HiveConf hconf,
            Map<String, PrunedPartitionList> partitionCache, Map<String, ColumnStatsList> colStatsCache,
            AtomicInteger noColsMissingStats) { ....
      
      
          Pair<List<ImmutableBitSet>, List<ImmutableBitSet>> constraintKeys = generateKeys();
          this.keys = constraintKeys.left;
          this.nonNullablekeys = constraintKeys.right;
          this.referentialConstraints = generateReferentialConstraints();
      }
      

      This is triggered from the rules as the partition pruner

        protected void perform(RelOptRuleCall call, Filter filter,
            HiveTableScan tScan) {
          // Original table
          RelOptHiveTable hiveTable = (RelOptHiveTable) tScan.getTable();
      
          // Copy original table scan and table
          HiveTableScan tScanCopy = tScan.copyIncludingTable(tScan.getRowType());
          RelOptHiveTable hiveTableCopy = (RelOptHiveTable) tScanCopy.getTable();
      ...
      
          if (StringUtils.equals(hiveTableCopy.getPartitionListKey(), hiveTable.getPartitionListKey())) {
            // Nothing changed, we do not need to produce a new expression
            return;
          }
      
      

      Attachments

        1. HIVE-21818.patch
          19 kB
          jcamachorodriguez
        2. HIVE-21818.05.patch
          31 kB
          jcamachorodriguez
        3. HIVE-21818.05.patch
          31 kB
          jcamachorodriguez
        4. HIVE-21818.05.patch
          31 kB
          jcamachorodriguez
        5. HIVE-21818.04.patch
          23 kB
          jcamachorodriguez
        6. HIVE-21818.04.patch
          23 kB
          jcamachorodriguez
        7. HIVE-21818.03.patch
          23 kB
          jcamachorodriguez
        8. HIVE-21818.02.patch
          23 kB
          jcamachorodriguez
        9. HIVE-21818.01.patch
          22 kB
          jcamachorodriguez

        Issue Links

          Activity

            People

              jcamacho Jesús Camacho Rodríguez
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m