BUG: Concat multiple different ExtensionArray types
State: closed

xref https://github.com/pandas-dev/pandas/issues/22994

This builds on https://github.com/pandas-dev/pandas/pull/22996, since we need hashing.

2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2 is the relevant commit.

Sparse tests will fail for now. I'll revisit once SparseArray is in. 

Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
Hello @TomAugspurger! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/dtypes/base.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/core/dtypes/base.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/dtypes.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/core/dtypes/dtypes.py) !

 - There are no PEP8 issues in the file [`pandas/core/internals/managers.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/core/internals/managers.py) !

 - There are no PEP8 issues in the file [`pandas/tests/extension/base/dtype.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/tests/extension/base/dtype.py) !

 - There are no PEP8 issues in the file [`pandas/tests/extension/decimal/array.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/tests/extension/decimal/array.py) !

 - There are no PEP8 issues in the file [`pandas/tests/extension/json/array.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/tests/extension/json/array.py) !

 - There are no PEP8 issues in the file [`pandas/tests/reshape/test_concat.py`](https://github.com/TomAugspurger/pandas/blob/2a1660c77e8ad0c28485c6d81227ac9d6b6de4f2/pandas/tests/reshape/test_concat.py) !


> Corner case: other is an instance of a subclass of type(self) and self._metadata != other._metadata

This relates to the commits adding hashing (which I was building on top of).

I think that's probably up to the EA author to define a `__eq__` that's correct. We can only do so much.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=h1) Report
> Merging [#22997](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/a0ca4d7b2773074ee6eedcd01056d5e45337af8b?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22997/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22997      +/-   ##
==========================================
+ Coverage   92.14%   92.14%   +<.01%     
==========================================
  Files         170      170              
  Lines       51016    51015       -1     
==========================================
+ Hits        47009    47010       +1     
+ Misses       4007     4005       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.57% <100%> (ø)` | :arrow_up: |
| #single | `42.31% <100%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `98.13% <ø> (+0.44%)` | :arrow_up: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `95.77% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `94.89% <0%> (-0.46%)` | :arrow_down: |
| [pandas/core/strings.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3RyaW5ncy5weQ==) | `98.58% <0%> (-0.05%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.11% <0%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `86.45% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/22997/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `95.56% <0%> (+1.27%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=footer). Last update [a0ca4d7...e17d397](https://codecov.io/gh/pandas-dev/pandas/pull/22997?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

I had to skip some decimal tests on py2.

I couldn't conditionally skip individual tests that had used fixtures defined on the test, e.g. `TestReshaping.test_concat_all_na_block[False]`, since that `in_frame` fixture isn't available to the subclass.

So I opted to skip all the tests on Py2 that had at least one test case failing.
I think this is good to go. Merging later today.

FYI, I'm leaving https://github.com/pandas-dev/pandas/issues/22994 open to discuss a more general concat protocol so that types can negotiate on what should happen. I'm hopeful that will clean up all the special concats we have like `concat_sparse` and `concat_categorical`.
Thanks!