title: Pyspark dataframe spliting columns gives empty result
body: <p>I am trying to split a column and allocate a new column name to split result.
  But it gives empty column. Please find below the Expression.</p>
  
  <p><strong>df.selectExpr("variable_name","split(variable_name, '.')[2] as r").show(100,False)</strong></p>
  
  <p>I am suppose to get ZZZZ as result column values in a</p>
  
  <p>It gives this <a href="https://i.stack.imgur.com/wMTlU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wMTlU.png" alt="result"></a></p>