title: Is there way to get a rowcount on a query using Snowflake and its Spark Connector?
body: <p>I am running a query in my Spark application that returns a substantially large amount of data. I would like to know how many rows of data are being queried for logging purposes. I can't seem to find a way to get the number of rows without either manually counting them, or calling a method to count for me, as the data is fairly large this gets expensive for logging. Is there a place that the rowcount is saved and available to grab? </p>
  
  <p>I have read <a href="https://docs.snowflake.net/manuals/user-guide/python-connector-api.html" rel="nofollow noreferrer">here</a> that the Python connector saves the rowcount into the object model, but i can't seem to find any equivalent for the Spark Connector or its underlying JDBC.</p>
  
  <p>The most optimal way I can find is <code>rdd.collect().size</code> on the RDD that Spark provides. It is about 15% faster than calling <code>rdd.count()</code></p>
  
  <p>Any help is appreciated </p>