phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [1/4] phoenix git commit: PHOENIX-3078. Hive storage handler does not work if phoenix.table.name contains the schema name
Date Fri, 22 Jul 2016 07:10:49 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 680990cb5 -> d744886a3
  refs/heads/4.x-HBase-1.0 314a011fe -> c70fa534d
  refs/heads/4.x-HBase-1.1 bfb19c17a -> b32816971
  refs/heads/master e864c5d2f -> 3878f3cbf


PHOENIX-3078. Hive storage handler does not work if phoenix.table.name contains the schema
name

Signed-off-by: Sergey Soldatov <ssa@apache.org>


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

Branch: refs/heads/master
Commit: 3878f3cbfb31e2058adc32d92593a8743911569e
Parents: e864c5d
Author: Youngwoo Kim <ywkim@apache.org>
Authored: Sun Jul 17 17:45:15 2016 +0900
Committer: Sergey Soldatov <ssa@apache.org>
Committed: Fri Jul 22 00:05:59 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java | 2 +-
 .../main/java/org/apache/phoenix/hive/util/PhoenixUtil.java    | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3878f3cb/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java
----------------------------------------------------------------------
diff --git a/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java b/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java
index d920517..ae3675f 100644
--- a/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java
+++ b/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixMetaHook.java
@@ -139,7 +139,7 @@ public class PhoenixMetaHook implements HiveMetaHook {
                 ddl.append("  ").append(columnName).append(" ").append(columnType).append(",\n");
             }
         }
-        ddl.append("  ").append("constraint pk_").append(tableName).append(" primary key(")
+        ddl.append("  ").append("constraint pk_").append(PhoenixUtil.getTableSchema(tableName.toUpperCase())[1]).append("
primary key(")
                 .append(realRowKeys.deleteCharAt(realRowKeys.length() - 1)).append(")\n)\n");
 
         String tableOptions = tableParameterMap.get(PhoenixStorageHandlerConstants

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3878f3cb/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java b/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java
index 5f9b0ba..9dcb3ef 100644
--- a/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java
+++ b/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java
@@ -71,7 +71,8 @@ public class PhoenixUtil {
         boolean exist = false;
         DatabaseMetaData dbMeta = conn.getMetaData();
 
-        try (ResultSet rs = dbMeta.getTables(null, null, tableName.toUpperCase(), null))
{
+        String[] schemaInfo = getTableSchema(tableName.toUpperCase());
+        try (ResultSet rs = dbMeta.getTables(null, schemaInfo[0], schemaInfo[1], null)) {
             exist = rs.next();
 
             if (LOG.isDebugEnabled()) {
@@ -91,7 +92,8 @@ public class PhoenixUtil {
         Map<Short, String> primaryKeyColumnInfoMap = Maps.newHashMap();
         DatabaseMetaData dbMeta = conn.getMetaData();
 
-        try (ResultSet rs = dbMeta.getPrimaryKeys(null, null, tableName.toUpperCase())) {
+        String[] schemaInfo = getTableSchema(tableName.toUpperCase());
+        try (ResultSet rs = dbMeta.getPrimaryKeys(null, schemaInfo[0], schemaInfo[1])) {
             while (rs.next()) {
                 primaryKeyColumnInfoMap.put(rs.getShort("KEY_SEQ"), rs.getString("COLUMN_NAME"));
             }


Mime
View raw message