phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] BinShi-SecularBird commented on a change in pull request #419: PHOENIX-4009 Run UPDATE STATISTICS command by using MR integration on…
Date Tue, 08 Jan 2019 22:41:28 GMT
BinShi-SecularBird commented on a change in pull request #419: PHOENIX-4009 Run UPDATE STATISTICS
command by using MR integration on…
URL: https://github.com/apache/phoenix/pull/419#discussion_r246181280
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/iterate/SnapshotScanner.java
 ##########
 @@ -18,54 +18,83 @@
 
 package org.apache.phoenix.iterate;
 
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.hbase.client.*;
-
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.AbstractClientScanner;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.IsolationLevel;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.metrics.MetricRegistry;
-import org.apache.hadoop.hbase.regionserver.*;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.Region;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
-import org.apache.phoenix.schema.PTable;
-import org.apache.phoenix.util.*;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.mapreduce.util.ConnectionUtil;
+import org.apache.phoenix.schema.stats.MapperStatisticsCollector;
+import org.apache.phoenix.schema.stats.NoOpStatisticsCollector;
+import org.apache.phoenix.schema.stats.StatisticsCollector;
+import org.apache.phoenix.util.ScanUtil;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutorService;
 
+/**
+ * Scan over a region from restored snapshot
+ */
 public class SnapshotScanner extends AbstractClientScanner {
 
   private static final Log LOG = LogFactory.getLog(SnapshotScanner.class);
-
-  private RegionScanner scanner = null;
+  private final Scan scan;
+  private RegionScanner scanner;
   private HRegion region;
-  List<Cell> values;
+  private List<Cell> values;
+  private StatisticsCollector statisticsCollector;
 
   public SnapshotScanner(Configuration conf, FileSystem fs, Path rootDir,
       HTableDescriptor htd, HRegionInfo hri,  Scan scan) throws Throwable{
 
+    LOG.info("Creating SnapshotScanner for region: " + hri);
+
     scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED);
     values = new ArrayList<>();
     this.region = HRegion.openHRegion(conf, fs, rootDir, hri, htd, null, null, null);
+    this.scan = scan;
 
     RegionCoprocessorEnvironment snapshotEnv = getSnapshotContextEnvironment(conf);
 
-    RegionScannerFactory regionScannerFactory;
-    if (scan.getAttribute(BaseScannerRegionObserver.NON_AGGREGATE_QUERY) != null) {
-      regionScannerFactory = new NonAggregateRegionScannerFactory(snapshotEnv);
+    // Collect statistics during scan if ANALYZE_TABLE attribute is set
+    if (ScanUtil.isAnalyzeTable(scan)) {
+      this.scanner = region.getScanner(scan);
 
 Review comment:
   Assert(scan.getAttribute(BaseScannerRegionObserver.NON_AGGREGATE_QUERY) == null) for updating
statistics?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message