drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansinha100 <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-1328: Support table statistics
Date Sat, 26 Mar 2016 18:16:29 GMT
Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/425#discussion_r57517236
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStatsTable.java
---
    @@ -0,0 +1,161 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.planner.common;
    +
    +import java.util.Map;
    +
    +import com.google.common.base.Preconditions;
    +import com.google.common.collect.Maps;
    +import org.apache.calcite.rel.RelNode;
    +import org.apache.calcite.rel.RelVisitor;
    +import org.apache.calcite.rel.core.TableScan;
    +import org.apache.drill.exec.client.DrillClient;
    +import org.apache.drill.exec.ops.QueryContext;
    +import org.apache.drill.exec.planner.logical.DrillTable;
    +import org.apache.drill.exec.proto.UserBitShared;
    +import org.apache.drill.exec.server.DrillbitContext;
    +import org.apache.drill.exec.server.rest.QueryWrapper.Listener;
    +
    +/**
    + * Wraps the stats table info including schema and tableName. Also materializes stats
from storage and keeps them in
    + * memory.
    + */
    +public class DrillStatsTable {
    +  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillStatsTable.class);
    +
    +  /**
    +   * List of columns in stats table.
    +   */
    +  public static final String COL_COLUMN = "column";
    +  public static final String COL_COMPUTED = "computed";
    +  public static final String COL_STATCOUNT = "statcount";
    +  public static final String COL_NDV = "ndv";
    +
    +  private final String schemaName;
    +  private final String tableName;
    +
    +  private final Map<String, Long> ndv = Maps.newHashMap();
    +  private double rowCount = -1;
    +
    +  private boolean materialized = false;
    +
    +  public DrillStatsTable(String schemaName, String tableName) {
    --- End diff --
    
    When updating the drill stats file on the filesystem, similar to metadata cache we should
add a check: recompute stats only if the directory modification time is later than the last
stats timestamp.  No need to recompute if stats is not stale. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message