phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmaho...@apache.org
Subject phoenix git commit: PHOENIX-3427 phoenix-spark: Table undefined for tenant specific view (Nico Pappagianis) [Addendum]
Date Fri, 11 Nov 2016 00:00:47 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 d27b4f9bb -> 9c367e279


PHOENIX-3427 phoenix-spark: Table undefined for tenant specific view (Nico Pappagianis) [Addendum]


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 9c367e279d20b2a059b0462a6dc17fd1492387e3
Parents: d27b4f9
Author: Josh Mahonin <jmahonin@gmail.com>
Authored: Thu Nov 10 18:59:25 2016 -0500
Committer: Josh Mahonin <jmahonin@gmail.com>
Committed: Thu Nov 10 19:00:38 2016 -0500

----------------------------------------------------------------------
 .../apache/phoenix/spark/AbstractPhoenixSparkIT.scala    | 11 +++++++----
 .../phoenix/spark/PhoenixSparkITTenantSpecific.scala     | 11 ++---------
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9c367e27/phoenix-spark/src/it/scala/org/apache/phoenix/spark/AbstractPhoenixSparkIT.scala
----------------------------------------------------------------------
diff --git a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/AbstractPhoenixSparkIT.scala
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/AbstractPhoenixSparkIT.scala
index 27dfe81..f81438f 100644
--- a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/AbstractPhoenixSparkIT.scala
+++ b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/AbstractPhoenixSparkIT.scala
@@ -14,9 +14,11 @@
 package org.apache.phoenix.spark
 
 import java.sql.{Connection, DriverManager}
+import java.util.Properties
 
 import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT
 import org.apache.phoenix.query.BaseTest
+import org.apache.phoenix.util.PhoenixRuntime
 import org.apache.spark.{SparkConf, SparkContext}
 import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
 
@@ -64,12 +66,13 @@ class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfterA
   // Runs SQL commands located in the file defined in the sqlSource argument
   // Optional argument tenantId used for running tenant-specific SQL
   def setupTables(sqlSource: String, tenantId: Option[String]): Unit = {
-    val url = tenantId match {
-      case Some(tenantId) => PhoenixSparkITHelper.getUrl + ";TenantId=" + tenantId
-      case _ => PhoenixSparkITHelper.getUrl
+    val props = new Properties
+    val id = tenantId match {
+      case Some(tid) => props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tid)
+      case _ =>
     }
 
-    conn = DriverManager.getConnection(url)
+    conn = DriverManager.getConnection(PhoenixSparkITHelper.getUrl, props)
     conn.setAutoCommit(true)
 
     val setupSqlSource = getClass.getClassLoader.getResourceAsStream(sqlSource)

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9c367e27/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkITTenantSpecific.scala
----------------------------------------------------------------------
diff --git a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkITTenantSpecific.scala
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkITTenantSpecific.scala
index 4231849..a1c1e22 100644
--- a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkITTenantSpecific.scala
+++ b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkITTenantSpecific.scala
@@ -13,6 +13,7 @@
  */
 package org.apache.phoenix.spark
 
+import org.apache.phoenix.util.PhoenixRuntime
 import org.apache.spark.sql.SQLContext
 
 import scala.collection.mutable.ListBuffer
@@ -53,14 +54,6 @@ class PhoenixSparkITTenantSpecific extends AbstractPhoenixSparkIT {
     // Save to tenant-specific view
     df.saveToPhoenix("TENANT_VIEW", zkUrl = Some(quorumAddress), tenantId = Some(TenantId))
 
-    df.write
-      .format("org.apache.phoenix.spark")
-      .mode("overwrite")
-      .option("table", "TENANT_VIEW")
-      .option("TenantId", "theTenant")
-      .option("zkUrl", PhoenixSparkITHelper.getUrl)
-      .save()
-
     verifyResults
   }
 
@@ -77,7 +70,7 @@ class PhoenixSparkITTenantSpecific extends AbstractPhoenixSparkIT {
       .format("org.apache.phoenix.spark")
       .mode("overwrite")
       .option("table", "TENANT_VIEW")
-      .option("TenantId", "theTenant")
+      .option(PhoenixRuntime.TENANT_ID_ATTRIB, "theTenant")
       .option("zkUrl", PhoenixSparkITHelper.getUrl)
       .save()
 


Mime
View raw message