<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Running phoenix flashback queries / setting currentSCN properties for spark-shell in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175106#M58202</link>
    <description>&lt;P&gt;This feature behaves unexpectedly when the table is migrated from another HBase cluster. In this case, the table creation time can be much later than the row timestamps of &lt;EM&gt;all &lt;/EM&gt;its data.  A flashback query meant to select an earlier subset of data will return the following failure instead:&lt;/P&gt;&lt;PRE&gt;scala&amp;gt; df.count
2017-08-11 20:12:40,550 INFO  [main] mapreduce.PhoenixInputFormat: UseSelectColumns=true, selectColumnList.size()=3, selectColumnList=TIMESTR,DBID,OPTION 
2017-08-11 20:12:40,550 INFO  [main] mapreduce.PhoenixInputFormat: Select Statement: SELECT "TIMESTR","DBID","OPTION" FROM NS.USAGES
2017-08-11 20:12:40,558 ERROR [main] mapreduce.PhoenixInputFormat: Failed to get the query plan with error [ERROR 1012 (42M03): Table undefined. tableName=NS.USAGES]
org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
TungstenAggregate(key=[], functions=[(count(1),mode=Final,isDistinct=false)], output=[count#13L])
+- TungstenExchange SinglePartition, None
   +- TungstenAggregate(key=[], functions=[(count(1),mode=Partial,isDistinct=false)], output=[count#16L])
      +- Project
         +- Scan ExistingRDD[TIMESTR#10,DBID#11,OPTION#12] 

        at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
        at org.apache.spark.sql.execution.aggregate.TungstenAggregate.doExecute(TungstenAggregate.scala:80)
...&lt;/PRE&gt;&lt;P&gt;Which apparently means that Phoenix considers the table nonexistent at this point.  I tested the same approach in sqlline and sure enough, the table is missing from "!tables"&lt;/P&gt;&lt;P&gt;Any workaround?&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 04:20:35 GMT</pubDate>
    <dc:creator>MilesYao</dc:creator>
    <dc:date>2017-08-14T04:20:35Z</dc:date>
    <item>
      <title>Running phoenix flashback queries / setting currentSCN properties for spark-shell</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175104#M58200</link>
      <description>&lt;P&gt;How to specify / run flashback / snapshot query in spark-shell given one has already setup phoenix-spark?&lt;/P&gt;&lt;P&gt;Assuming it has already been setup with the correct jars to run this:&lt;/P&gt;&lt;PRE&gt;import org.apache.phoenix.spark._
val df_new = sc.parallelize(Seq((345, "some org"), (456, "ORG_ID_1"))).toDF("ID", "ORG_ID")
df_new.saveToPhoenix("MY_TABLE") // I presume it will be some param. within phoenixTableAsDataFrame?
sqlContext.phoenixTableAsDataFrame("MY_TABLE", Array("ID", "ORG_ID")).show
+-------+---------+
|     ID|   ORG_ID|
+-------+---------+
|    456| ORD_ID_1|
|    345| some org|
+-------+---------+&lt;/PRE&gt;&lt;P&gt;Is it possible?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 17:09:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175104#M58200</guid>
      <dc:creator>David_Tam</dc:creator>
      <dc:date>2017-03-27T17:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Running phoenix flashback queries / setting currentSCN properties for spark-shell</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175105#M58201</link>
      <description>&lt;P&gt;After looking at &lt;A href="https://github.com/apache/phoenix/blob/master/phoenix-spark/src/main/scala/org/apache/phoenix/spark/SparkSqlContextFunctions.scala"&gt;the source&lt;/A&gt; and &lt;A href="https://issues.apache.org/jira/browse/PHOENIX-2429"&gt;this jira&lt;/A&gt; I have finally got round to do it in spark-shell:&lt;/P&gt;&lt;PRE&gt;import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil
import org.apache.hadoop.conf.Configuration
import org.apache.phoenix.spark._
val conf = new Configuration
conf.setLong(PhoenixConfigurationUtil.CURRENT_SCN_VALUE, 1490706922000)
sqlContext.phoenixTableAsDataFrame("TRADE.TRADE", Array("ID", "BROKER"), conf = conf).show
&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2017 18:14:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175105#M58201</guid>
      <dc:creator>David_Tam</dc:creator>
      <dc:date>2017-03-29T18:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Running phoenix flashback queries / setting currentSCN properties for spark-shell</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175106#M58202</link>
      <description>&lt;P&gt;This feature behaves unexpectedly when the table is migrated from another HBase cluster. In this case, the table creation time can be much later than the row timestamps of &lt;EM&gt;all &lt;/EM&gt;its data.  A flashback query meant to select an earlier subset of data will return the following failure instead:&lt;/P&gt;&lt;PRE&gt;scala&amp;gt; df.count
2017-08-11 20:12:40,550 INFO  [main] mapreduce.PhoenixInputFormat: UseSelectColumns=true, selectColumnList.size()=3, selectColumnList=TIMESTR,DBID,OPTION 
2017-08-11 20:12:40,550 INFO  [main] mapreduce.PhoenixInputFormat: Select Statement: SELECT "TIMESTR","DBID","OPTION" FROM NS.USAGES
2017-08-11 20:12:40,558 ERROR [main] mapreduce.PhoenixInputFormat: Failed to get the query plan with error [ERROR 1012 (42M03): Table undefined. tableName=NS.USAGES]
org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
TungstenAggregate(key=[], functions=[(count(1),mode=Final,isDistinct=false)], output=[count#13L])
+- TungstenExchange SinglePartition, None
   +- TungstenAggregate(key=[], functions=[(count(1),mode=Partial,isDistinct=false)], output=[count#16L])
      +- Project
         +- Scan ExistingRDD[TIMESTR#10,DBID#11,OPTION#12] 

        at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
        at org.apache.spark.sql.execution.aggregate.TungstenAggregate.doExecute(TungstenAggregate.scala:80)
...&lt;/PRE&gt;&lt;P&gt;Which apparently means that Phoenix considers the table nonexistent at this point.  I tested the same approach in sqlline and sure enough, the table is missing from "!tables"&lt;/P&gt;&lt;P&gt;Any workaround?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 04:20:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-phoenix-flashback-queries-setting-currentSCN/m-p/175106#M58202</guid>
      <dc:creator>MilesYao</dc:creator>
      <dc:date>2017-08-14T04:20:35Z</dc:date>
    </item>
  </channel>
</rss>

