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 Wed, 09 Jan 2019 01:26:39 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_r246230713
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixInputFormat.java
 ##########
 @@ -180,23 +179,39 @@ private QueryPlan getQueryPlan(final JobContext context, final Configuration
con
             try (final Connection connection = ConnectionUtil.getInputConnection(configuration,
overridingProps);
                  final Statement statement = connection.createStatement()) {
 
-              final String selectStatement = PhoenixConfigurationUtil.getSelectStatement(configuration);
+              SchemaType schemaType = PhoenixConfigurationUtil.getSchemaType(configuration);
+
+              String selectStatement;
+              switch (schemaType) {
+                  case UPDATE_STATS:
+                      // This select statement indicates MR job for full table scan for stats
collection
+                      selectStatement = "SELECT * FROM " + PhoenixConfigurationUtil.getInputTableName(configuration);
+                      break;
+                  default:
+                      selectStatement = PhoenixConfigurationUtil.getSelectStatement(configuration);
+              }
               Preconditions.checkNotNull(selectStatement);
 
               final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
               // Optimize the query plan so that we potentially use secondary indexes
               final QueryPlan queryPlan = pstmt.optimizeQuery(selectStatement);
               final Scan scan = queryPlan.getContext().getScan();
+
+              if (schemaType == SchemaType.UPDATE_STATS) {
+                  StatisticsUtil.setScanAttributes(scan, null);
 
 Review comment:
   Could you check whether you need to set "scan.setAttribute(RUN_UPDATE_STATS_ASYNC_ATTRIB,
FALSE_BYTES);" here?

----------------------------------------------------------------
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