<?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>topic Pyspark datatype missing microsecond precision last three SSS: h:mm:ss:SSSSSS - datetype in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pyspark-datatype-missing-microsecond-precision-last-three-sss-h/m-p/52867#M29634</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;We are having issues with the datetype data type in spark when ingesting files.&lt;/P&gt;&lt;P&gt;Effectively the source data has 6 microseconds worth of precision but the most we can extract from the datatype is three. For example 12:03:23.123, but what is required is&amp;nbsp;12:03:23.123456. The source file has this precision but when the file is ingested. Here is an example:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;df.select(to_timestamp(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"date_col"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;"yyyy-MM-dd"&lt;/SPAN&gt;&lt;SPAN&gt;).alias(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"date"&lt;/SPAN&gt;&lt;SPAN&gt;), to_timestamp(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"timestamp_col"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;"yyyy-MM-dd HH:mm:ss.SSS"&lt;/SPAN&gt;&lt;SPAN&gt;).alias(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"timestamp"&lt;/SPAN&gt;&lt;SPAN&gt;)).show(truncate=&lt;/SPAN&gt;&lt;SPAN class=""&gt;False&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt; &lt;SPAN class=""&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;34&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;56.789&lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt;&lt;SPAN&gt; 01:&lt;/SPAN&gt;&lt;SPAN class=""&gt;23&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;45.678&lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;the requirement is for&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt; &lt;SPAN class=""&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;34&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;56.456789.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Jay&lt;/P&gt;</description>
    <pubDate>Sat, 18 Nov 2023 14:07:35 GMT</pubDate>
    <dc:creator>jimbo</dc:creator>
    <dc:date>2023-11-18T14:07:35Z</dc:date>
    <item>
      <title>Pyspark datatype missing microsecond precision last three SSS: h:mm:ss:SSSSSS - datetype</title>
      <link>https://community.databricks.com/t5/data-engineering/pyspark-datatype-missing-microsecond-precision-last-three-sss-h/m-p/52867#M29634</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;We are having issues with the datetype data type in spark when ingesting files.&lt;/P&gt;&lt;P&gt;Effectively the source data has 6 microseconds worth of precision but the most we can extract from the datatype is three. For example 12:03:23.123, but what is required is&amp;nbsp;12:03:23.123456. The source file has this precision but when the file is ingested. Here is an example:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;df.select(to_timestamp(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"date_col"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;"yyyy-MM-dd"&lt;/SPAN&gt;&lt;SPAN&gt;).alias(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"date"&lt;/SPAN&gt;&lt;SPAN&gt;), to_timestamp(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"timestamp_col"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;"yyyy-MM-dd HH:mm:ss.SSS"&lt;/SPAN&gt;&lt;SPAN&gt;).alias(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"timestamp"&lt;/SPAN&gt;&lt;SPAN&gt;)).show(truncate=&lt;/SPAN&gt;&lt;SPAN class=""&gt;False&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt; &lt;SPAN class=""&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;34&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;56.789&lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt;&lt;SPAN&gt; 01:&lt;/SPAN&gt;&lt;SPAN class=""&gt;23&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;45.678&lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;the requirement is for&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;-03-&lt;/SPAN&gt;&lt;SPAN class=""&gt;16&lt;/SPAN&gt; &lt;SPAN class=""&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;34&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;56.456789.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Jay&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2023 14:07:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pyspark-datatype-missing-microsecond-precision-last-three-sss-h/m-p/52867#M29634</guid>
      <dc:creator>jimbo</dc:creator>
      <dc:date>2023-11-18T14:07:35Z</dc:date>
    </item>
  </channel>
</rss>

