title: How to change column datatype with pyarrow
body: <p>I am reading a set of arrow files and am writing them to a parquet file:</p>
  <pre><code>import pathlib
  from pyarrow import parquet as pq
  from pyarrow import feather
  import pyarrow as pa
  
  base_path = pathlib.Path('../mydata')
  
  fields = [
      pa.field('value', pa.int64()),
      pa.field('code', pa.dictionary(pa.int32(), pa.uint64(), ordered=False)),
  ]
  schema = pa.schema(fields)
  
  with pq.ParquetWriter('sample.parquet', schema) as pqwriter:
      for file_path in base_path.glob('*.arrow'):
          table = feather.read_table(file_path)
          pqwriter.write_table(table)
  </code></pre>
  <p>My problem is that the <code>code</code> field in the arrow files is defined with an <code>int8</code> index instead of <code>int32</code>. The range of <code>int8</code> however is insufficient. Hence I defined a schema with a <code>int32</code> index for the field <code>code</code> in the parquet file.</p>
  <p>However, writing the arrow table to parquet now complains that the schemas do not match.</p>
  <p>How can I change the datatype of the arrow column? I checked the pyarrow API and did not find a way to change the schema. Can this be done without roundtripping to pandas?</p>