You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Hive QA (JIRA)" <ji...@apache.org> on 2015/08/08 23:46:45 UTC
[jira] [Commented] (HIVE-11278) Partition.setOutputFormatClass
should not do toString for Class object
[ https://issues.apache.org/jira/browse/HIVE-11278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14663187#comment-14663187 ]
Hive QA commented on HIVE-11278:
--------------------------------
{color:green}Overall{color}: +1 all checks pass
Here are the results of testing the latest attachment:
https://issues.apache.org/jira/secure/attachment/12749211/HIVE-11278.01.patch
{color:green}SUCCESS:{color} +1 9344 tests passed
Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/4877/testReport
Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/4877/console
Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-4877/
Messages:
{noformat}
Executing org.apache.hive.ptest.execution.PrepPhase
Executing org.apache.hive.ptest.execution.ExecutionPhase
Executing org.apache.hive.ptest.execution.ReportingPhase
{noformat}
This message is automatically generated.
ATTACHMENT ID: 12749211 - PreCommit-HIVE-TRUNK-Build
> Partition.setOutputFormatClass should not do toString for Class object
> -----------------------------------------------------------------------
>
> Key: HIVE-11278
> URL: https://issues.apache.org/jira/browse/HIVE-11278
> Project: Hive
> Issue Type: Bug
> Reporter: Rajat Khandelwal
> Assignee: Rajat Khandelwal
> Attachments: HIVE-11278.01.patch
>
>
> https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java#L286
> inside setInputFormatClass, we're doing:
> {noformat}
> public void setInputFormatClass(Class<? extends InputFormat> inputFormatClass) {
> this.inputFormatClass = inputFormatClass;
> tPartition.getSd().setInputFormat(inputFormatClass.getName());
> }
> {noformat}
> But inside setOutputFormatClass, we're doing toString for class, instead of getName().
> {noformat}
> public void setOutputFormatClass(Class<? extends HiveOutputFormat> outputFormatClass) {
> this.outputFormatClass = outputFormatClass;
> tPartition.getSd().setOutputFormat(HiveFileFormatUtils
> .getOutputFormatSubstitute(outputFormatClass).toString());
> }
> {noformat}
> Difference is that, for Class A.class, toString is "class A.class", getName is "A.class". So Class.forName(cls.getName()) succeeds, but Class.forName(cls.toString()) is not valid.
> So if you get a partition, set outputformat, and make an alter call, then get the partition again and make a getOutputFormatClass call on that object, it throws a ClassNotFoundException on https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java#L316, because it's basically calling Class.forName("class a.b.c.ClassName.class") which is wrong!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)