kadirozde commented on a change in pull request #434: PHOENIX-5018 Index 
mutations created by UPSERT SELECT will have wrong…
URL: https://github.com/apache/phoenix/pull/434#discussion_r255651595
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
 ##########
 @@ -443,17 +448,44 @@ private Job configureJobForAysncIndex(String schemaName, 
String indexTable, Stri
 
                 // set input for map reduce job using hbase snapshots
                 PhoenixMapReduceUtil
-                    .setInput(job, PhoenixIndexDBWritable.class, snapshotName, 
qDataTable, restoreDir, selectQuery);
+                            .setInput(job, PhoenixIndexDBWritable.class, 
snapshotName, qDataTable, restoreDir, selectQuery);
             }
             TableMapReduceUtil.initCredentials(job);
             
             if (useDirectApi) {
-                return configureSubmittableJobUsingDirectApi(job, false);
+                job.setMapperClass(PhoenixIndexImportDirectMapper.class);
+                return configureSubmittableJobUsingDirectApi(job);
             } else {
                 return configureRunnableJobUsingBulkLoad(job, outputPath);
-                
             }
-            
+        }
+
+        private Job configureJobForServerBuildIndex()
+                throws Exception {
+
+            PhoenixConfigurationUtil.setIndexToolDataTableName(configuration, 
qDataTable);
+            PhoenixConfigurationUtil.setIndexToolIndexTableName(configuration, 
qIndexTable);
+
+            String physicalIndexTable = 
pIndexTable.getPhysicalName().getString();
+
+            PhoenixConfigurationUtil.setPhysicalTableName(configuration, 
physicalIndexTable);
+            PhoenixConfigurationUtil.setDisableIndexes(configuration, 
indexTable);
+
+            fs = outputPath.getFileSystem(configuration);
+            fs.delete(outputPath, true);
+
+            final String jobName = String.format(INDEX_JOB_NAME_TEMPLATE, 
schemaName, dataTable, indexTable);
+            final Job job = Job.getInstance(configuration, jobName);
+            job.setJarByClass(IndexTool.class);
+            job.setMapOutputKeyClass(ImmutableBytesWritable.class);
+            FileOutputFormat.setOutputPath(job, outputPath);
 
 Review comment:
   When I remove the code for setting the output path, there is always one 
other test failing. There are total of 120 tests. I tried restructuring the 
IndexTool code so that the output path is set only when bulk loading is enabled 
but did not help. So, I will leave the code as it is. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to