title: In Spark,According to the mapping table, is there any way to convert an array of strings into the corresponding array of integers
body: <p>In Spark, according to the mapping table (String -> Integer), is there any way to convert an array of strings into the corresponding array of integers?</p>
  
  <p>Ex: In Spark, There are 500 million arrays,</p>
  
  <pre><code>Array String 1 : ['TOM','White','Black'] 
  Array String 2 : ['BCD','TTTT','Black']
  .....
  </code></pre>
  
  <p>Mapping Table： [BCD -> 1, White -> 2,Black -> 3, TTT -> 4 ,TOM ->5, ...]  (one million).</p>
  
  <p>Result:</p>
  
  <pre><code>Array Integer 1 : [5,2,3]
  Array Integer 2 : [1,4,1]
  ....
  </code></pre>