<?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 How to insert nano seconds in the TimestampType in Spark? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-insert-nano-seconds-in-the-TimestampType-in-Spark/m-p/175194#M58217</link>
    <description>&lt;P&gt;Spark Version : 1.6.1

I have a text table in hive having `timestamp` datatype with nanoseconds precision.

Hive Table Schema:
       &lt;/P&gt;&lt;PRE&gt;c_timestamp     timestamp   &lt;/PRE&gt;&lt;P&gt;

Hive Table data:&lt;/P&gt;&lt;PRE&gt;00:00:00.000000001&lt;/PRE&gt;&lt;PRE&gt;23:59:59.999999999&lt;/PRE&gt;&lt;P&gt;

But as per the &lt;A href="https://spark.apache.org/docs/1.6.0/sql-programming-guide.html#upgrading-from-spark-sql-14-to-15"&gt;docs&lt;/A&gt;, from Spark 1.5

&lt;EM&gt;&lt;STRONG&gt; Timestamps are now stored at a precision of 1us, rather than 1ns&lt;/STRONG&gt;&lt;/EM&gt;

Sample code:
&lt;/P&gt;&lt;PRE&gt;SparkConf conf = new SparkConf(true).setMaster("yarn-cluster").setAppName("SAMPLE_APP");&lt;/PRE&gt;&lt;PRE&gt;SparkContext sc = new SparkContext(conf);&lt;/PRE&gt;&lt;PRE&gt;HiveContext hc = new HiveContext(sc);&lt;/PRE&gt;&lt;PRE&gt;DataFrame df = hc.table("testdb.tbl1");&lt;/PRE&gt;&lt;P&gt;
Data is truncated to microseconds. 

Is there any way to use nanoseconds here?&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2017 19:37:29 GMT</pubDate>
    <dc:creator>dev_emr</dc:creator>
    <dc:date>2017-03-27T19:37:29Z</dc:date>
    <item>
      <title>How to insert nano seconds in the TimestampType in Spark?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-insert-nano-seconds-in-the-TimestampType-in-Spark/m-p/175194#M58217</link>
      <description>&lt;P&gt;Spark Version : 1.6.1

I have a text table in hive having `timestamp` datatype with nanoseconds precision.

Hive Table Schema:
       &lt;/P&gt;&lt;PRE&gt;c_timestamp     timestamp   &lt;/PRE&gt;&lt;P&gt;

Hive Table data:&lt;/P&gt;&lt;PRE&gt;00:00:00.000000001&lt;/PRE&gt;&lt;PRE&gt;23:59:59.999999999&lt;/PRE&gt;&lt;P&gt;

But as per the &lt;A href="https://spark.apache.org/docs/1.6.0/sql-programming-guide.html#upgrading-from-spark-sql-14-to-15"&gt;docs&lt;/A&gt;, from Spark 1.5

&lt;EM&gt;&lt;STRONG&gt; Timestamps are now stored at a precision of 1us, rather than 1ns&lt;/STRONG&gt;&lt;/EM&gt;

Sample code:
&lt;/P&gt;&lt;PRE&gt;SparkConf conf = new SparkConf(true).setMaster("yarn-cluster").setAppName("SAMPLE_APP");&lt;/PRE&gt;&lt;PRE&gt;SparkContext sc = new SparkContext(conf);&lt;/PRE&gt;&lt;PRE&gt;HiveContext hc = new HiveContext(sc);&lt;/PRE&gt;&lt;PRE&gt;DataFrame df = hc.table("testdb.tbl1");&lt;/PRE&gt;&lt;P&gt;
Data is truncated to microseconds. 

Is there any way to use nanoseconds here?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 19:37:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-insert-nano-seconds-in-the-TimestampType-in-Spark/m-p/175194#M58217</guid>
      <dc:creator>dev_emr</dc:creator>
      <dc:date>2017-03-27T19:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert nano seconds in the TimestampType in Spark?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-insert-nano-seconds-in-the-TimestampType-in-Spark/m-p/175195#M58218</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/13571/devemr.html" nodeid="13571"&gt;@Devender Yadav&lt;/A&gt;, It seems that TimeStampType do not support nanoseconds yet. &lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/SPARK-17914" target="_blank"&gt;https://issues.apache.org/jira/browse/SPARK-17914&lt;/A&gt; is opened to track this issue. &lt;/P&gt;&lt;P&gt;You might want to use some other data type like String to store this data if you require nanoseconds data. &lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 04:23:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-insert-nano-seconds-in-the-TimestampType-in-Spark/m-p/175195#M58218</guid>
      <dc:creator>yvora</dc:creator>
      <dc:date>2017-03-29T04:23:18Z</dc:date>
    </item>
  </channel>
</rss>

