Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 b775ce7da -> 9bf4df0c7


PHOENIX-2596 Asynchronous Local Index is not available(Rajeshbabu)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9bf4df0c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9bf4df0c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9bf4df0c

Branch: refs/heads/4.x-HBase-0.98
Commit: 9bf4df0c7d96add08a04dd71693c65004bf5f382
Parents: b775ce7
Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org>
Authored: Tue Jun 7 12:13:32 2016 +0530
Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org>
Committed: Tue Jun 7 12:13:32 2016 +0530

----------------------------------------------------------------------
 .../phoenix/mapreduce/AbstractBulkLoadTool.java | 21 ++------------------
 .../phoenix/mapreduce/index/IndexTool.java      |  4 ++--
 .../org/apache/phoenix/util/SchemaUtil.java     | 16 +++++++++++++++
 .../phoenix/mapreduce/BulkLoadToolTest.java     |  5 +++--
 4 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bf4df0c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
index 0525de9..faf20db 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
@@ -183,10 +183,10 @@ public abstract class AbstractBulkLoadTool extends 
Configured implements Tool {
         String tableName = cmdLine.getOptionValue(TABLE_NAME_OPT.getOpt());
         String schemaName = cmdLine.getOptionValue(SCHEMA_NAME_OPT.getOpt());
         String indexTableName = 
cmdLine.getOptionValue(INDEX_TABLE_NAME_OPT.getOpt());
-        String qualifiedTableName = getQualifiedTableName(schemaName, 
tableName);
+        String qualifiedTableName = 
SchemaUtil.getQualifiedTableName(schemaName, tableName);
         String qualifiedIndexTableName = null;
         if (indexTableName != null){
-            qualifiedIndexTableName = getQualifiedTableName(schemaName, 
indexTableName);
+            qualifiedIndexTableName = 
SchemaUtil.getQualifiedTableName(schemaName, indexTableName);
         }
 
         if (cmdLine.hasOption(ZK_QUORUM_OPT.getOpt())) {
@@ -342,23 +342,6 @@ public abstract class AbstractBulkLoadTool extends 
Configured implements Tool {
     }
 
     /**
-     * Calculate the HBase HTable name for which the import is to be done.
-     *
-     * @param schemaName import schema name, can be null
-     * @param tableName import table name
-     * @return the byte representation of the import HTable
-     */
-    @VisibleForTesting
-    static String getQualifiedTableName(String schemaName, String tableName) {
-        if (schemaName != null) {
-            return String.format("%s.%s", 
SchemaUtil.normalizeIdentifier(schemaName),
-                    SchemaUtil.normalizeIdentifier(tableName));
-        } else {
-            return SchemaUtil.normalizeIdentifier(tableName);
-        }
-    }
-
-    /**
      * Perform any required validation on the table being bulk loaded into:
      * - ensure no column family names start with '_', as they'd be ignored 
leading to problems.
      * @throws java.sql.SQLException

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bf4df0c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
index 6743688..fc1292a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
@@ -181,8 +181,8 @@ public class IndexTool extends Configured implements Tool {
             final String schemaName = 
cmdLine.getOptionValue(SCHEMA_NAME_OPTION.getOpt());
             final String dataTable = 
cmdLine.getOptionValue(DATA_TABLE_OPTION.getOpt());
             final String indexTable = 
cmdLine.getOptionValue(INDEX_TABLE_OPTION.getOpt());
-            final String qDataTable = SchemaUtil.getTableName(schemaName, 
dataTable);
-            final String qIndexTable = SchemaUtil.getTableName(schemaName, 
indexTable);
+            final String qDataTable = 
SchemaUtil.getQualifiedTableName(schemaName, dataTable);
+            final String qIndexTable = 
SchemaUtil.getQualifiedTableName(schemaName, indexTable);
 
             connection = ConnectionUtil.getInputConnection(configuration);
             if (!isValidIndexTable(connection, qDataTable, indexTable)) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bf4df0c/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
index 41e5704..b53daea 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
@@ -1025,4 +1025,20 @@ public class SchemaUtil {
         return physicalTableName.indexOf(indexPrefix) == 0 ? 
physicalTableName.substring(indexPrefix.length())
                 : physicalTableName;
     }
+
+    /**
+     * Calculate the HBase HTable name.
+     *
+     * @param schemaName import schema name, can be null
+     * @param tableName import table name
+     * @return the byte representation of the HTable
+     */
+    public static String getQualifiedTableName(String schemaName, String 
tableName) {
+        if (schemaName != null) {
+            return String.format("%s.%s", normalizeIdentifier(schemaName),
+                    normalizeIdentifier(tableName));
+        } else {
+            return normalizeIdentifier(tableName);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9bf4df0c/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/BulkLoadToolTest.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/BulkLoadToolTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/BulkLoadToolTest.java
index 95e9b43..425c333 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/BulkLoadToolTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/mapreduce/BulkLoadToolTest.java
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import java.util.Collection;
 
 import org.apache.commons.cli.CommandLine;
+import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -68,11 +69,11 @@ public class BulkLoadToolTest {
 
     @Test
     public void testGetQualifiedTableName() {
-        assertEquals("MYSCHEMA.MYTABLE", 
CsvBulkLoadTool.getQualifiedTableName("mySchema", "myTable"));
+        assertEquals("MYSCHEMA.MYTABLE", 
SchemaUtil.getQualifiedTableName("mySchema", "myTable"));
     }
 
     @Test
     public void testGetQualifiedTableName_NullSchema() {
-        assertEquals("MYTABLE", CsvBulkLoadTool.getQualifiedTableName(null, 
"myTable"));
+        assertEquals("MYTABLE", SchemaUtil.getQualifiedTableName(null, 
"myTable"));
     }
 }

Reply via email to