Athena SELECT * from Glue table results in "HIVE_BAD_DATA: Error Parsing a column in the table: Current entry must be closed before a null can be written"

1

I've imported a dataset of JSON objects that all have consistent schema. Glue crawler finished successfully and created a table. I can select * with a limit in Athena, but when I select all rows I get this error:

HIVE_BAD_DATA: Error Parsing a column in the table: Current entry must be closed before a null can be written

Why would a SELECT need to write a null? Is it talking about writing to the results bucket?

Googling for the error gives me just a handful of results to some BlockBuilder Presto source code:

@Override
    public BlockBuilder appendNull()
    {
        if (currentEntrySize > 0) {
            throw new IllegalStateException("Current entry must be closed before a null can be written");
        }

        hasNullValue = true;
        entryAdded(0, true);
        return this;
    }
asked 23 days ago288 views
1 Answer
0

I had the same error. Turns out the problem had to do with an incorrect column data type. In my case, I specified INT against a column containing values greater than INT's max size of 2^31-1. Changing the column's data type to BIGINT or STRING fixed it for me.

Migs
answered 8 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions