Help Center/ MapReduce Service/ Troubleshooting/ Using Hive/ An Error Is Reported When Hive Executes the insert into Statement
Updated on 2023-11-30 GMT+08:00

An Error Is Reported When Hive Executes the insert into Statement

Symptom

When a user uses MRS Hive to execute a SQL statement, the following error message is displayed.

Figure 1 Error reported when MRS Hive executes a SQL statement

Cause Analysis

  1. The HiveServer log shows the following message at the time when the error is reported.
    Figure 2 HiveServer log
  2. No important information is found in that log, but the metadata field is found in the stack. Therefore, the error may be related to MetaStore.
    Figure 3 Metadata in the stack
  3. The MetaStore log shows the following error information.
    Figure 4 MetaStore log

    The error context indicates that an error occurs during SQL statement execution, and the following information is displayed in the error message:

    Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)

    The SQL statement fails because the length of all columns exceeds 4000 bytes. The restriction needs to be modified.

Procedure

  1. Log in to any master node in the cluster as user root and run the su - omm command to switch to user omm.
  2. Run the following command to log in to the database. There can be security risks if a command contains the authentication password. You are advised to disable the command recording function (history) before running the command.

    gsql -p 20051 -d hivemeta -U username -W password

  3. Run the following command to modify the restriction:

    alter table PARTITION_PARAMS alter column PARAM_VALUE type varchar(6000);