ARROW-13965: [C++] dynamic_casts in parquet TypedColumnWriterImpl impacting performance
ARROW-13965: [C++] dynamic_casts in parquet TypedColumnWriterImpl impacting performance

This PR adds observer pointers to TypedColumnWriterImpl to avoid repeated dynamic_casts upon writing many small batches.  This can lead to significant performance gains.  As an example, using stream_reader_writer from examples/parquet/parquet_stream_api modified to write 20M rows, an improvement of over 30% was seen in write times.
```
original:
52.919u 2.146s 0:55.81 98.6%	0+0k 0+2646928io 0pf+0w
53.328u 2.327s 0:56.38 98.6%	0+0k 0+2646928io 0pf+0w
53.048u 2.341s 0:56.06 98.7%	0+0k 0+2646928io 0pf+0w

patched:
35.367u 2.012s 0:37.88 98.6%	0+0k 0+2646928io 0pf+0w
35.133u 1.717s 0:37.36 98.6%	0+0k 0+2646928io 0pf+0w
35.228u 1.950s 0:37.61 98.8%	0+0k 0+2646928io 0pf+0w
```

Closes #11131 from etseidl/downcast

Lead-authored-by: seidl <04279286ed9f6a19b782d9f6bd9696e307548118@llnl.gov>
Co-authored-by: Antoine Pitrou <9359a4d812173b65a3a0094cd86363e79731a3c2@python.org>
Co-authored-by: etseidl <0304af2e98cfa46261704d7220b84af07970f351@users.noreply.github.com>
Signed-off-by: Antoine Pitrou <9359a4d812173b65a3a0094cd86363e79731a3c2@python.org>

wesm/arrow,wesm/arrow,wesm/arrow,icexelloss/arrow,kou/arrow,wesm/arrow,kou/arrow,laurentgo/arrow,kou/arrow,apache/arrow,kou/arrow,icexelloss/arrow,laurentgo/arrow,kou/arrow,icexelloss/arrow,kou/arrow,wesm/arrow,icexelloss/arrow,wesm/arrow,icexelloss/arrow,kou/arrow,icexelloss/arrow,laurentgo/arrow,apache/arrow,apache/arrow,wesm/arrow,apache/arrow,wesm/arrow,icexelloss/arrow,laurentgo/arrow,laurentgo/arrow,laurentgo/arrow,laurentgo/arrow,laurentgo/arrow,apache/arrow,kou/arrow,apache/arrow,apache/arrow,icexelloss/arrow,apache/arrow,icexelloss/arrow,kou/arrow,laurentgo/arrow,apache/arrow,wesm/arrow,laurentgo/arrow,icexelloss/arrow,icexelloss/arrow,laurentgo/arrow,wesm/arrow,wesm/arrow,kou/arrow,apache/arrow,kou/arrow,icexelloss/arrow,laurentgo/arrow,kou/arrow,wesm/arrow,apache/arrow,icexelloss/arrow,kou/arrow,apache/arrow,kou/arrow,icexelloss/arrow,laurentgo/arrow,laurentgo/arrow,wesm/arrow,apache/arrow,laurentgo/arrow,apache/arrow,wesm/arrow