title: spark sql distance to nearest holiday
body: <p>In pandas I have a function similar to</p>
  
  <pre><code>indices = df.dateColumn.apply(holidays.index.searchsorted)
  df['nextHolidays'] = holidays.index[indices]
  df['previousHolidays'] = holidays.index[indices - 1]
  </code></pre>
  
  <p>which calculates the distance to the nearest holiday and stores that as a new column. </p>
  
  <p><code>searchsorted</code> <a href="http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.Series.searchsorted.html" rel="nofollow noreferrer">http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.Series.searchsorted.html</a> was a great solution for pandas as this gives me the index of the next holiday without a high algorithmic complexity <a href="https://stackoverflow.com/questions/39284989/parallelize-pandas-apply">Parallelize pandas apply</a> e.g. this approach was a lot quicker then parallel looping.</p>
  
  <p>How can I achieve this in spark or hive?</p>