title: How to detect if decimal columns should be converted into integer or double?
body: <p>I use <strong>Apache spark</strong> as an ETL tool to fetch tables from <strong>Oracle</strong> into <strong>Elasticsearch</strong>.</p>
  
  <p>I face an issue with numeric columns that <strong>spark</strong> recognize them as <code>decimal</code> whereas <strong>Elasticsearch</strong> doesn't accept <code>decimal</code> type; so i convert each <code>decimal</code> columns into <code>double</code> which is accepted for <strong>Elasticsearch</strong>.</p>
  
  <pre><code>dataFrame = dataFrame.select(
      [col(name) if 'decimal' not in colType else col(name).cast('double') for name, colType in dataFrame.dtypes]
  )
  </code></pre>
  
  <p>The current issue that every numeric column will be <strong>double</strong>; either it has <strong>decimal</strong> value or not.</p>
  
  <p>My question is there any way to detect column type should be converted into either integer type or double?</p>