Support Questions

Find answers, ask questions, and share your expertise

Unable to create UDF in cloudera quickstart VM

avatar
Explorer

I would like to create UDF on Cloudera VM, when i try to create a temporary function i am getting following Error.

FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.FunctionTask.
com/udf/StringSplitter : Unsupported major.minor version 52.0

Below i am attaching my sample Java Class 

package com.udf;

import org.apache.hadoop.hive.ql.exec.UDF;

public class StringSplitter extends UDF {
	
	public String[] evaluate(String name) {
		
		String[] result = name.split("[\\''/*]");
 		return result;
	}

}

i have created an executable jar and added on Cloudera. But i am unable to create Temporary Function.

hive> add jar Desktop/StringSplitter.jar;
Added [Desktop/StringSplitter.jar] to class path
Added resources: [Desktop/StringSplitter.jar]

hive> create temporary function strsplit as 'com.udf.StringSplitter'; FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.FunctionTask. com/udf/StringSplitter : Unsupported major.minor version 52.0
1 ACCEPTED SOLUTION

avatar
Super Guru
Hi,

The error message "Unsupported major.minor version 52.0" means the UDF jar file was compile on a version of Java that is different to the one used for HS2.

If you run below command:

javap -verbose com/udf/StringSplitter.class | grep "major"

What is the number returned?

Below are the major version number for different version of Java:

Java 5 uses major version 49
Java 6 uses major version 50
Java 7 uses major version 51
Java 8 uses major version 52
Java 9 uses major version 53

So you need to compile using the Java that has the same version that HS2 runs under.

Hope above helps.

View solution in original post

1 REPLY 1

avatar
Super Guru
Hi,

The error message "Unsupported major.minor version 52.0" means the UDF jar file was compile on a version of Java that is different to the one used for HS2.

If you run below command:

javap -verbose com/udf/StringSplitter.class | grep "major"

What is the number returned?

Below are the major version number for different version of Java:

Java 5 uses major version 49
Java 6 uses major version 50
Java 7 uses major version 51
Java 8 uses major version 52
Java 9 uses major version 53

So you need to compile using the Java that has the same version that HS2 runs under.

Hope above helps.