From b29e6b732d939ce617743ae0ea3cf2ca5008aa0a Mon Sep 17 00:00:00 2001 From: Benjamin Kietzman Date: Thu, 5 Sep 2019 17:12:11 -0400 Subject: [PATCH] don't try to dictionary encode dictionary arrays --- cpp/src/arrow/python/arrow_to_pandas.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc b/cpp/src/arrow/python/arrow_to_pandas.cc index a6541ce56e9..2f3f3550ae0 100644 --- a/cpp/src/arrow/python/arrow_to_pandas.cc +++ b/cpp/src/arrow/python/arrow_to_pandas.cc @@ -1951,6 +1951,10 @@ Status ConvertTableToPandas(const PandasOptions& options, for (int i = 0; i < table->num_columns(); i++) { std::shared_ptr col = table->column(i); if (categorical_columns.count(table->field(i)->name())) { + if (table->field(i)->type()->id() == Type::DICTIONARY) { + // this column is already dictionary encoded + continue; + } Datum out; RETURN_NOT_OK(DictionaryEncode(&ctx, Datum(col), &out)); std::shared_ptr array = out.chunked_array();