Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - UnitTest did not pass during compile the latest hive code


Copy link to this message
-
Re: UnitTest did not pass during compile the latest hive code
Thejas Nair 2013-11-07, 22:58
You can use System.getProperty("test.tmp.dir") instead of '/tmp' . That is
more portable.
It would be wonderful if you can create a new issue in hive jira (
https://issues.apache.org/jira/browse/HIVE) and attach a patch with this
change!

On Tue, Nov 5, 2013 at 9:02 PM, 金杰 <[EMAIL PROTECTED]> wrote:

> I modify the test code. And it passed the test.
>
> See the diff below, Could anyone fix it?
>
>
> diff --git
> hcatalog/core/src/test/java/org/apache/hcatalog/cli/TestUseDatabase.java
> hcatalog/core/src/test/java/org/apache/hcatalog/cli/TestUseDatabase.java
> index d164da3..6624849 100644
> ---
> hcatalog/core/src/test/java/org/apache/hcatalog/cli/TestUseDatabase.java
> +++
> hcatalog/core/src/test/java/org/apache/hcatalog/cli/TestUseDatabase.java
> @@ -19,6 +19,7 @@
>  package org.apache.hcatalog.cli;
>
>  import java.io.IOException;
> +import java.io.File;
>
>  import junit.framework.TestCase;
>
> @@ -63,7 +64,10 @@ public void testAlterTablePass() throws IOException,
> CommandNeedRetryException {
>
>      CommandProcessorResponse response;
>
> -    response = hcatDriver.run("alter table " + tblName + " add partition
> (b='2') location '/tmp'");
> +    File tmp = new File(System.getProperty("java.io.tmpdir") +
> "/hive-junit-test-" + System.nanoTime());
> +    tmp.mkdir();
> +    tmp.deleteOnExit();
> +    response = hcatDriver.run("alter table " + tblName + " add partition
> (b='2') location '" + tmp.getAbsolutePath() + "'");
>      assertEquals(0, response.getResponseCode());
>      assertNull(response.getErrorMessage());
>
> diff --git
> hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestUseDatabase.java
> hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestUseDatabase.java
> index f362b69..e0247ad 100644
> ---
> hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestUseDatabase.java
> +++
> hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestUseDatabase.java
> @@ -19,6 +19,7 @@
>  package org.apache.hive.hcatalog.cli;
>
>  import java.io.IOException;
> +import java.io.File;
>
>  import junit.framework.TestCase;
>
> @@ -61,7 +62,10 @@ public void testAlterTablePass() throws IOException,
> CommandNeedRetryException {
>
>      CommandProcessorResponse response;
>
> -    response = hcatDriver.run("alter table " + tblName + " add partition
> (b='2') location '/tmp'");
> +    File tmp = new File(System.getProperty("java.io.tmpdir") +
> "/hive-junit-test-" + System.nanoTime());
> +    tmp.mkdir();
> +    tmp.deleteOnExit();
> +    response = hcatDriver.run("alter table " + tblName + " add partition
> (b='2') location '" + tmp.getAbsolutePath() + "'");
>      assertEquals(0, response.getResponseCode());
>      assertNull(response.getErrorMessage());
>
>
>
> Best Regards
> 金杰 (Jay Jin)
>
>
> On Wed, Nov 6, 2013 at 10:51 AM, 金杰 <[EMAIL PROTECTED]> wrote:
>
>> Thanks Tim & Thejas
>>
>> I trying to compile the latest code because I want to learn HIVE code.
>>
>> I have compiled HIVE successfully.
>>
>> But still have problem in running the tests.
>>
>> The test
>>
>> ./hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestUseDatabase.java
>> failed to pass the junit test.
>>
>> we have code below in the test code:
>>
>> CommandProcessorResponse response;
>>
>> response = hcatDriver.run("alter table " + tblName + " add partition
>> (b='2') location '/tmp'");
>> assertEquals(0, response.getResponseCode());
>> assertNull(response.getErrorMessage());
>>
>> The code is trying to read /tmp directory. But, in my /tmp directory,
>> there is a file name "fcitx-socket-:0".
>> Accroding to this issue https://issues.apache.org/jira/browse/HADOOP-7945 hadoop
>> did not allow ":" in filename.
>> The code print following message:
>>
>> FAILED: Execution Error, return code 1 from
>> org.apache.hadoop.hive.ql.exec.DDLTask.
>> MetaException(message:java.lang.IllegalArgumentException:
>> java.net.URISyntaxException: Relative path in absolute URI: fcitx-socket-:0)
>>
>> I'm trying to fix it.
>>
>>
>> Best Regards

CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender immediately
and delete it from your system. Thank You.