title: Spark Streaming: How to get the count of the timestamps for a day?
body: <p>Reading the streaming from a kafka topic where data has timestamp. This data can have future or past timestamps as well.<br/>
  Is there way to get the count of the data coming in for a day?
  I tried to cast the <code>timestamp</code> into <code>date</code> and then aggregated on the <code>date</code> and get the <code>sum</code> as the <code>count</code>. It doesn't seem to work.</p>
  
  <pre><code>sourceDataset
                  .withWatermark("timestamp", watermarkInterval)
                  .select(
                          col("timestamp").cast("date")
                  )
                  .groupBy(
                          functions.window(col("date"), windowInterval)
                  ).sum().as("count")
                  ;
  </code></pre>