[
https://issues.apache.org/jira/browse/PHOENIX-3427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15648811#comment-15648811
]
ASF GitHub Bot commented on PHOENIX-3427:
-----------------------------------------
Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/221#discussion_r87025450
--- Diff:
phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala ---
@@ -60,16 +60,21 @@ class PhoenixSparkIT extends FunSuite with Matchers
with BeforeAndAfterAll {
ConfigurationUtil.getZookeeperURL(hbaseConfiguration).get
}
- override def beforeAll() {
- PhoenixSparkITHelper.doSetup
+ // 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
+ }
- conn = DriverManager.getConnection(PhoenixSparkITHelper.getUrl)
+ conn = DriverManager.getConnection(url)
--- End diff --
Better to set TenantId in Properties and use
DriverManager.getConnection(url, props) than muck with the URL string
> rdd.saveToPhoenix gives table undefined error when attempting to write to a
> tenant-specific view (TenantId defined in configuration object and passed to
> saveToPhoenix)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-3427
> URL: https://issues.apache.org/jira/browse/PHOENIX-3427
> Project: Phoenix
> Issue Type: Bug
> Reporter: Nico Pappagianis
>
> Although we can read from a tenant-specific view by passing TenantId in the
> conf object when calling sc.phoenixTableAsRDD the same does not hold for
> rdd.saveToPhoenix. Calling saveToPhoenix with a tenant-specific view as the
> table name gives a table undefined error, even when passing in the TenantId
> with the conf object.
> It appears that TenantId is lost during the execution path of saveToPhoenix.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)