phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [2/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:50 GMT
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/d744886a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d744886a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d744886a

Branch: refs/heads/4.x-HBase-0.98
Commit: d744886a33ab15a2e326cfdb839e0664aac63d1b
Parents: 680990c
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:06:24 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/d744886a/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/d744886a/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 e889b63..6afe23b 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