Pivotal Knowledge Base

Follow

ERROR: value too long for type character varying(4000)

Problem

When loading data into Hive external table, you may encounter below error snippet:

FAILED: Error in metadata: MetaException(message:javax.jdo.JDODataStoreException:  request failed : INSERT INTO "SERDE_PARAMS" ("PARAM_VALUE","SERDE_ID","PARAM_KEY") VALUES (?,?,?)  org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:313)
at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:660)
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)

This Error occurs when the value length exceeds default maximum character length of 4000 in Hive.

Workaround

If this is an external table, then non-native tables cannot be altered in Hive as of version 0.13. 

https://issues.apache.org/jira/browse/HIVE-1240

You can alter the table and reload the data !

EX: ALTER TABLE "SERDE_PARAMS" ALTER COLUMN "PARAM_VALUE" type varchar(10000);

Note: We will keep updating this document as we find more reasons for the same issue.

Comments

Powered by Zendesk