Support Questions

Find answers, ask questions, and share your expertise

Emmanuel Katto Dubai : Can anyone guide me on why this is happening and how I can fix the issue?

avatar

Hi Everyone, I am Emmanuel Katto Dubai, United Arab Emirates (UAE) It appears you're encountering an issue when attempting to run an INSERT INTO query on a Hive table with the Tez execution engine. You mentioned that the query works fine when inserting data into integer columns but fails when inserting into string columns. Additionally, the issue seems related to the Kryo serialization in the logs, where Hive is unable to deserialize the required classes. Here's a breakdown and a few suggestions to troubleshoot the issue:

 

Error Analysis:

  1. Error Type:

    • The main error seems to be related to a serialization issue
KryoException: Encountered unregistered class ID: 112


 

 

    • This indicates that Hive, during execution, is attempting to deserialize an object that hasn't been registered with the Kryo serializer. This might be related to how the Tez engine handles serialization during the execution of the query.
  1. YARN Logs:

    • The error trace shows a failure at the map phase (Map 1), caused by ROOT_INPUT_INIT_FAILURE. This is typically due to an issue with data initialization or deserialization, which is happening during the execution of the query.
  2. Working with INSERT INTO:

    • You noted that inserting into integer columns works fine, while inserting into string columns fails. This discrepancy suggests that there might be a data type or serialization mismatch between what Hive expects and what Tez can handle when dealing with strings.
  3. LOAD DATA Command Works:

    • Since loading data using the LOAD DATA command works fine, it suggests that your table and data are properly set up and that the issue may lie with the execution engine or how data is being handled by Tez in this particular insert query.

Suggestions for Resolution:

  1. Check Hive and Tez Compatibility: Ensure that your Hive and Tez versions are compatible. Sometimes, there are serialization issues caused by mismatches between different versions of Hive, Tez, and Hadoop.

  2. Serialization Configuration: The error message points to issues with the Kryo serializer. You can try configuring Hive to use a different serializer. Add the following configurations to your hive-site.xml or at the session level:

    xml
    Copy code
    <property> <name>hive.tez.container.size</name> <value>1024</value> </property> <property> <name>hive.execution.engine</name> <value>mr</value> </property>

    This switches the execution engine to MapReduce instead of Tez, which might help identify if Tez is indeed the cause of the problem.

  3. Insert Values Syntax: Double-check the syntax and the data being inserted. While you mentioned that inserting integers works, ensure that your string values are properly quoted and the column types in the table match the types you're trying to insert.

    Example of a valid insert:

 

  • INSERT INTO TABLE test VALUES ('a', 'b');

Recheck Table Definitions: Ensure the table's column types are defined correctly as strings. You can check the table structure with:

DESCRIBE test;
 
  1. If the columns are not defined as STRING, this could lead to issues with serialization.

  2. Tez Configuration and Debugging: Sometimes, Tez-specific issues can be resolved by tweaking the configuration in tez-site.xml. You can increase the logging level for Tez and Hive to capture more detailed logs about what's failing during the execution. This might give you more insights into what's going wrong.

  3. Cluster Resource Availability: The error might also relate to resource allocation on YARN or the configuration of the Tez AM (Application Master). Check if your cluster has enough resources allocated, and ensure that Tez is properly configured to handle the workload.

Testing the Query:

  1. Simple Insert with Strings (Test): To isolate the issue, try inserting data with simpler values (single-letter strings) into the table:

    sql
    Copy code
    INSERT INTO test VALUES ('x', 'y');

    This can help rule out potential issues with the data values you're using in the original query.

  2. Switch Execution Engine Temporarily: If you're unable to resolve the issue, consider temporarily switching the execution engine to mr (MapReduce) instead of tez to see if the issue persists:

SET hive.execution.engine=mr; INSERT INTO test VALUES ('a', 'b');

  1. Hive and Tez Logs: The Tez logs provide important details on why the query fails. Examine the Tez application logs in the YARN ResourceManager UI to identify if there are any specific issues during the map or reduce phase that could explain the failure.

By following these steps and troubleshooting the configuration, you should be able to pinpoint the issue and fix it.

 

Regards

Emmanuel Katto

 

 

0 REPLIES 0