GithubHelp home page GithubHelp logo

hiverunner / hiverunner Goto Github PK

View Code? Open in Web Editor NEW
252.0 34.0 79.0 1.43 MB

An Open Source unit test framework for Hive queries based on JUnit 4 and 5

License: Apache License 2.0

Java 99.95% HiveQL 0.05%
hive junit test-framework testing klarna-featured hive-sql

hiverunner's Introduction

Maven Central Build License

ScreenShot

HiveRunner

Welcome to HiveRunner - Zero installation open source unit testing of Hive applications.

Watch the HiveRunner teaser on youtube!

Welcome to the open source project HiveRunner. HiveRunner is a unit test framework based on JUnit (4 & 5) and enables TDD development of Hive SQL without the need for any installed dependencies. All you need is to add HiveRunner to your pom.xml as any other library and you're good to go.

HiveRunner is under constant development. It is used extensively by many companies. Please feel free to suggest improvements both as pull requests and as written requests.

Overview

HiveRunner enables you to write Hive SQL as releasable tested artifacts. It will require you to parametrize and modularize Hive SQL in order to make it testable. The bits and pieces of code should then be wired together with some orchestration/workflow/build tool of your choice, to be runnable in your environment (e.g. Oozie, Pentaho, Talend, Maven, etc…)

So, even though your current Hive SQL probably won't run off the shelf within HiveRunner, we believe the enforced testability and enabling of a TDD workflow will do as much good to the scripting world of SQL as it has for the Java community.

Cook Book

1. Include HiveRunner

HiveRunner is published to Maven Central. To start to use it, add a dependency to HiveRunner to your pom file:

<dependency>
    <groupId>io.github.hiverunner</groupId>
    <artifactId>hiverunner</artifactId>
    <version>[HIVERUNNER VERSION]</version>
    <scope>test</scope>
</dependency>

Alternatively, if you want to build from source, clone this repo and build with:

 mvn install

Then add the dependency as mentioned above.

Also explicitly add the surefire plugin and configure forkMode=always to avoid OutOfMemory when building big test suites.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.21.0</version>
    <configuration>
        <forkMode>always</forkMode>
    </configuration>
</plugin>

As an alternative if this does not solve the OOM issues, try increase the -Xmx and -XX:MaxPermSize settings. For example:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.21.0</version>
    <configuration>
        <forkCount>1</forkCount>
        <reuseForks>false</reuseForks>
        <argLine>-Xmx2048m -XX:MaxPermSize=512m</argLine>
    </configuration>
</plugin>

(please note that the forkMode option is deprecated and you should use forkCount and reuseForks instead)

With forkCount and reuseForks there is a possibility to reduce the test execution time drastically, depending on your hardware. A plugin configuration which are using one fork per CPU core and reuse threads would look like:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.21.0</version>
    <configuration>
        <forkCount>1C</forkCount>
        <reuseForks>true</reuseForks>
        <argLine>-Xmx2048m -XX:MaxPermSize=512m</argLine>
    </configuration>
</plugin>

By default, HiveRunner uses mapreduce (mr) as the execution engine for Hive. If you wish to run using Tez, set the System property hiveconf_hive.execution.engine to 'tez'.

(Any Hive conf property may be overridden by prefixing it with 'hiveconf_')

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
        <configuration>
            <systemProperties>
                <hiveconf_hive.execution.engine>tez</hiveconf_hive.execution.engine>
                <hiveconf_hive.exec.counters.pull.interval>1000</hiveconf_hive.exec.counters.pull.interval>
            </systemProperties>
        </configuration>
    </plugin>

Timeout

It's possible to configure HiveRunner to make tests time out after some time and retry those tests a couple of times, but only when using StandaloneHiveRunner as this is not available in the HiveRunnerExtension (from HiveRunner 5.x and up). This is to cover for the bug https://issues.apache.org/jira/browse/TEZ-2475 that at times causes test cases to not terminate due to a lost DAG reference. The timeout feature can be configured via the 'enableTimeout', 'timeoutSeconds' and 'timeoutRetries' properties. A configuration which enables timeouts after 30 seconds and allows 2 retries would look like:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.21.0</version>
    <configuration>
        <systemProperties>
            <enableTimeout>true</enableTimeout>
            <timeoutSeconds>30</timeoutSeconds>
            <timeoutRetries>2</timeoutRetries>
        </systemProperties>
    </configuration>
</plugin>

Logging

HiveRunner uses SLF4J so you should configure logging in your tests using any compatible logging framework.

2. Look at the examples

Look at the com.klarna.hiverunner.examples.HelloHiveRunnerTest reference test case to get a feeling for how a typical test case looks like in JUnit5. To find JUnit4 versions of the examples, look at com.klarna.hiverunner.examples.junit4.HelloHiveRunnerTest.

If you're put off by the verbosity of the annotations, there's always the possibility to use HiveShell in a more interactive mode. The com.klarna.hiverunner.SerdeTest adds a resource (test data) interactively with HiveShell instead of using annotations.

Annotations and interactive mode can be mixed and matched, however you'll always need to include the com.klarna.hiverunner.annotations.HiveSQL annotation e.g:

     @HiveSQL(files = {"serdeTest/create_table.sql", "serdeTest/hql_custom_serde.sql"}, autoStart = false)
     public HiveShell hiveShell;

Note that the autostart = false is needed for the interactive mode. It can be left out when running with only annotations.

Sequence files

If you work with sequence files (Or anything else than regular text files) make sure to take a look at ResourceOutputStreamTest for an example of how to use the new method HiveShell#getResourceOutputStream to manage test input data.

Programatically create test input data

Test data can be programmatically inserted into any Hive table using HiveShell.insertInto(...). This seamlessly handles different storage formats and partitioning types allowing you to focus on the data required by your test scenarios:

hiveShell.execute("create database test_db");
hiveShell.execute("create table test_db.test_table ("
    + "c1 string,"
    + "c2 string,"
    + "c3 string"
    + ")"
    + "partitioned by (p1 string)"
    + "stored as orc");

hiveShell.insertInto("test_db", "test_table")
    .withColumns("c1", "p1").addRow("v1", "p1")       // add { "v1", null, null, "p1" }
    .withAllColumns().addRow("v1", "v2", "v3", "p1")  // add { "v1", "v2", "v3", "p1" }
    .copyRow().set("c1", "v4")                        // add { "v4", "v2", "v3", "p1" }
    .addRowsFromTsv(file)                             // parses TSV data out of a file resource
    .addRowsFrom(file, fileParser)                    // parses custom data out of a file resource
    .commit();

See com.klarna.hiverunner.examples.InsertTestDataTest for working examples.

3. Understand the order of execution

HiveRunner will in default mode set up and start the HiveShell before the test method is invoked. If autostart is set to false, the HiveShell must be started manually from within the test method. Either way, HiveRunner will do the following steps when start is invoked:

  1. Merge any @HiveProperties from the test case with the Hive conf
  2. Start the HiveServer with the merged conf
  3. Copy all @HiveResource data into the temp file area for the test
  4. Execute all fields annotated with @HiveSetupScript
  5. Execute the script files given in the @HiveSQL annotation

The HiveShell field annotated with @HiveSQL will always be injected before the test method is invoked.

Hive version compatibility

  • This version of HiveRunner is built for Hive 3.1.2.

  • For Hive 2.x support please use HiveRunner 5.x.

  • Command shell emulations are provided to closely match the behaviour of both the Hive CLI and Beeline interactive shells. The desired emulation can be specified in your pom.xml file like so:

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.21.0</version>
          <configuration>
              <systemProperties>
                  <!-- Defaults to HIVE_CLI, other options include BEELINE and HIVE_CLI_PRE_V200 -->
                  <commandShellEmulator>BEELINE</commandShellEmulator>
              </systemProperties>
          </configuration>
      </plugin>
    

    Or provided on the command line using a system property:

    mvn -DcommandShellEmulator=BEELINE test
    

Future work and Limitations

  • HiveRunner does not allow the add jar statement. It is considered bad practice to keep environment specific code together with the business logic that targets HiveRunner. Keep environment specific stuff in separate files and use your build/orchestration/workflow tool to run the right files in the right order in the right environment. When running HiveRunner, all SerDes available on the classpath of the IDE/maven will be available.

  • HiveRunner runs Hive and Hive runs on top of Hadoop, and Hadoop has limited support for Windows machines. Installing Cygwin might help out.

  • Currently the HiveServer spins up and tears down for every test method. As a performance option it should be possible to clean the HiveServer and metastore between each test method invocation. The choice should probably be exposed to the test writer. By switching between different strategies, side effects/leakage can be ruled out during test case debugging. See #69.

Known Issues

UnknownHostException

I've had issues with UnknownHostException on OS X after upgrading my system or running Docker. Usually a restart of my machine solved it, but last time I got some corporate stuff installed the restarts stopped working and I kept getting UnknownHostExceptions. Following this simple guide solved my problem: http://crunchify.com/getting-java-net-unknownhostexception-nodename-nor-servname-provided-or-not-known-error-on-mac-os-x-update-your-privateetchosts-file/

Tez queries do not terminate

Tez will at times forget the process id of a random DAG. This will cause the query to never terminate. To get around this there is a timeout and retry functionality implemented in HiveRunner:

     <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.21.0</version>
         <configuration>
             <systemProperties>
                 <enableTimeout>true</enableTimeout>
                 <timeoutSeconds>30</timeoutSeconds>
                 <timeoutRetries>2</timeoutRetries>
                 </systemProperties>
         </configuration>
     </plugin>

Make sure to set the timeoutSeconds to that of your slowest test in the test suite and then add some padding.

Contact

Mailing List

If you would like to ask any questions about or discuss HiveRunner please join our mailing list at

https://groups.google.com/forum/#!forum/hive-runner-user

History

This project was initially developed and maintained by Klarna and then by Expedia Group before moving to its own top-level organisation on GitHub.

Legal

This project is available under the Apache 2.0 License.

Copyright 2021 The HiveRunner Contributors Copyright 2013-2021 Klarna AB

hiverunner's People

Contributors

actions-user avatar alexdgarland avatar cmathiesen avatar dependabot[bot] avatar fabiogm avatar fs111 avatar jaygreeeen avatar jorgenfalk avatar konrad7d avatar labbedaine avatar lidlplus avatar massdosage avatar nahguam avatar patduin avatar pelleullberg avatar shermosa avatar skjs avatar skyahead avatar teabot avatar testyourmates avatar thomasplarsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hiverunner's Issues

Support for default variable scope

As far as I can tell the default variable scope in Hive is in fact hiveconf. HiveRunner supports this if it is declared explicitly on variable names. However, in the Hive CLI one can omit the hiveconf: prefix and it will silently use the scope regardless. Concretely, this all works in the CLI:

hive (default)> set xxx=one;
hive (default)> set xxx;
xxx=one
hive (default)> set hiveconf:xxx;
hiveconf:xxx=one

hive (default)> set hiveconf:yyy=two;
hive (default)> set hiveconf:yyy;
hiveconf:yyy=two
hive (default)> set yyy;
yyy=two

The default scope is hiveconf it seems.

HiveRunner does not support the same functionality. It requires that the hiveconf: prefix is provided and thus this test fails when I believe it should in fact pass:

@RunWith(StandaloneHiveRunner.class)
public class VariableTest {

  @HiveSQL(files = {})
  public HiveShell hiveShell;

  @HiveSetupScript
  public String setup = "set xxx=one;";

  @Test
  public void testDefaultScope() {
    Assert.assertEquals(Arrays.asList("xxx=one"), hiveShell.executeQuery("set xxx;"));
  }

}

Can we try and bring the behaviour of HiveRunner in line with the CLI?

Thanks.

Hive 2.1.0

I hope this helps anyone who wants to use Hiverunner with Hive 2.1.0.
I had to make some modifications for the tool to work on 2.1.0:

  1. Did not work on Windows, I had to run on Linux (see #45 )
  2. Switched Metastore to embedded Derby
  • set "datanucleus.schema.autoCreateAll" to "true"
  • modify StandaloneHiveServerContext.java
//metaStorageUrl = "jdbc:hsqldb:mem:" + UUID.randomUUID().toString();
metaStorageUrl = "jdbc:derby:;databaseName=" + basedir.getRoot().getAbsolutePath() + "/metastore_db";
  1. Hive API change
  • HiveServerContainer.java
21a22
> import org.apache.hadoop.hive.conf.HiveVariableSource;
23c24
< import org.apache.hadoop.hive.ql.parse.VariableSubstitution;
---
> import org.apache.hadoop.hive.conf.VariableSubstitution;
206c207,214
<         return new VariableSubstitution();
---
>         final SessionState ss = currentSessionState;
>         return new VariableSubstitution(new HiveVariableSource() {
>
>                       @Override
>                       public Map<String, String> getHiveVariable() {
>                               return ss.getHiveVariables();
>                       }
>               });

Connect to hive server started by hive runner using jdbc

Hi All,

Thanks in advance!
I am using hiveRunner project in testing hive queries.

I want to connect to hive server started by hiveRunner using JDBC, how can I do that?
What is

  1. hiveserver host
  2. hiveserver port
  3. hive server driver name (org.apache.hive.jdbc.HiveDriver) ?
  4. hive server user and
  5. hive server password

Regards,
Amey

Adding non-existent resource results in confusing error

One of our users has identified a potential problem with the way in which the HiveShell handles missing resources. They found that if they were using a HiveShell that was started manually (auto-start=false) then any other failures that occurred in the setup of the shell were not usefully reported. In this case they were trying at add a resource that did not in fact exist:

@HiveQSL(..., auto-start=false)
private HiveShell shell;

  @Before
  public void setup() {
    shell.addResource("this resource does not exist.");
    shell.start();
  }

However, the cryptic error thrown related to the test runner’s inability to tear down a HiveShell that had not been started. It would likely be more useful if we could instead bubble up the exception that prevented them from reaching the shell.start() statement, the inability to load a resource in this case.

The error message in question is of the form hive shell not started, occurring in a teardown method. Sorry that I cannot be more precise at this time. I'll endeavor to construct a test case.

On Windows, HiveRunner setup fails with "java.lang.IllegalStateException: Failed to create HiveServer :Error applying authorization policy on hive"

Hello,

I originally wrote this as a comment on:
#66

...but as that started as a different issue, it would be better to track this one separately.

When running the example HiveRunner test on Windows, it fails with:

java.lang.IllegalStateException: Failed to create HiveServer :Error applying authorization policy on hive
This is a machine on which there is no hive installed, so there would be no hive-site.xml on the classpath.

I am running from Eclipse (Oxygen) with the built-in JUnit runner.

I have tried HiveRunner 3.2.0 and 3.0.0 with the same result.

I should note that, to get this far on Windows, and had to make changes in "StandaloneHiveRunner" and "StandaloneHiveServerContext" to remove the lines ".setWritable(true, false)" on the folders that get created, since those calls fail in Windows on TemporaryFolder (they always return false). But those are the only changes.

I have also debugged and checked the values of the following AFTER HiveConf is initialized:
HiveConf.class.getClassLoader().getResource("hive-default.xml")
HiveConf.class.getClassLoader().getResource("hive-site.xml")
HiveConf.class.getClassLoader().getResource("hivemetastore-site.xml")
HiveConf.class.getClassLoader().getResource("hiveserver2-site.xml")
They are all "null"

I have tried to set up the project in an identical way on Linux, and it works. So it seems to be Windows-specific.

Any ideas what else I should look for?
Thanks

MD5 implementation unsupported

Hi Team we have religiously implemented the unit test with hive runners jar 3.2.1 snapshot
We are stuck with MD5 implementation can U help?
Below is my code:
Step one:
@HiveSQL(files = { my_source_table_ddl.hql,my_target_table_ddl.hql
}
, autoStart = false)

private HiveShell shell;

i am using below syntax to read the data from src to target table in my junit:
shell.execute(Paths.get("HQL_Files/TABLES/mytable_INSERT.hql"));
my insert query has the MD5 in it concatination of 3 coulmns.
output:
when i run junit it says md5 function is not available in hive part of hive runner.
observation:
i check couple of article it says hive.version 1.3.0 can resolve, but i see the hive runner pom with lower version

Kindly can you help

how to add hiverunner dependency in gradle

hi,
I am trying to use HiveRunner 2.5.1.
I have added following in my build.gradle
testCompile 'com.klarna:hiverunner:2.5.1'

But hiverunner is not getting loaded.

Please let me know if I am missing something.

Order of execution of tests using HiveRunner

Hi All,
Thanks in advance!

What is the order of execution when we have multiple tests in a same file.
Eg: HelloHiveRunner runs tests in the order

  1. testSelectFromCtas
  2. testSelectFromFooWithCustomDelimiter
  3. testTablesCreated
  4. testSelectFromFooWithTypeCheck

How is the order selected?

Regards,

TimeoutAndRetryTest test suite is nondeterministic

The com.klarna.hiverrunnrer.TimeoutAndRetryTest seems to fail/pass depending on the time it takes to execute. Increasing the timeout on the tests make them more likely to pass. In other environments the tests seem to pass consistently without issue.

Output from sample runs on the same codebase:

1.

Tests in error:
TimeoutAndRetryTest.endOnSecondRun » Timeout test timed out after 15 seconds
TimeoutAndRetryTest.expectTest » Timeout test timed out after 15 seconds
TimeoutAndRetryTest.throwOnSecondRun2 » Timeout test timed out after 15 second...
TimeoutAndRetryTest.expectTimoutTest » Timeout test timed out after 15 seconds
TimeoutAndRetryTest.throwOnSecondRun » Timeout test timed out after 15 seconds

2.

Results :
Tests run: 6, Failures: 0, Errors: 0, Skipped: 1

3.

Tests in error:
  TimeoutAndRetryTest.throwOnSecondRun » Timeout test timed out after 15 seconds
Tests run: 6, Failures: 0, Errors: 1, Skipped: 1

JSON to array of struct

Hi guys,

I have a table with a column of type array<struct<property1:string, property2:string>> and I have a *.csv file with values I want to insert into this table.
I am trying to insert into array column JSON ([{"property1": "1", "property2": "2"}]") and of course it is failing.
So there is a question: does exist some workaround to insert values into column of array type with HiveShell?

Access files from Hive UDF

Hello! I'm trying to test a GenericUDF similar to Hive's in_file() function. My custom function works well in hive shell (via hive and beeline with both local and yarn modes) but when running the same queries in tests I've got the following error:

WARN    [IntersectFileUDFTest#testSimpleStringArray]    org.apache.hadoop.security.UserGroupInformation    - PriviledgedActionException as:sergey (auth:SIMPLE) cause:java.io.IOException: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z
java.io.IOException: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z
	at org.apache.hadoop.mapred.LocalDistributedCacheManager.setup(LocalDistributedCacheManager.java:143)
	at org.apache.hadoop.mapred.LocalJobRunner$Job.<init>(LocalJobRunner.java:171)
	at org.apache.hadoop.mapred.LocalJobRunner.submitJob(LocalJobRunner.java:758)
	at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:244)
	at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1307)
	at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1304)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
...
Caused by: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.apache.hadoop.mapred.LocalDistributedCacheManager.setup(LocalDistributedCacheManager.java:139)
	... 50 more
Caused by: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z
	at org.apache.hadoop.yarn.util.FSDownload.changePermissions(FSDownload.java:394)
	at org.apache.hadoop.yarn.util.FSDownload.call(FSDownload.java:363)
	at org.apache.hadoop.yarn.util.FSDownload.call(FSDownload.java:60)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	... 1 more
Job Submission failed with exception 'java.io.IOException(java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z)'
ERROR   [IntersectFileUDFTest#testSimpleStringArray]    org.apache.hadoop.hive.ql.exec.Task    - Job Submission failed with exception 'java.io.IOException(java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.isSymlink(Ljava/io/File;)Z)'

I'm using HiveRunner 3.2.0, Hive 1.1.0-cdh5.9.1 for compiling and 1.2.1 in test scope and it works fine for other custom UDFs.

HiveRunner confuse by multiple HiveConf on the classpath

I would like to unit test my Hive scripts in the project where I run the production java code. HiveRunner works well when isolated but doesn't play very nicely when hive-jdbc is on the classpath. If I understand the Hive source code, it looks for a class HiveConf and use it for instanciation. Right now I have 2 HiveConf on the classpath, one from hive-exec and another one from hive-common. If I remove the hive-jdbc depedency from my project the unit test pass.

The error is the following. Could you please help.

java.lang.IllegalStateException: Failed to create HiveServer :Error applying authorization policy on hive configuration: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:102) at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150) at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:224) at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:176) at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:65) at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:92) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: Error applying authorization policy on hive configuration: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at org.apache.hive.service.cli.CLIService.init(CLIService.java:114) at org.apache.hive.service.CompositeService.init(CompositeService.java:59) at org.apache.hive.service.server.HiveServer2.init(HiveServer2.java:100) at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:85) ... 8 more Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522) at org.apache.hive.service.cli.CLIService.applyAuthorizationConfigPolicy(CLIService.java:127) at org.apache.hive.service.cli.CLIService.init(CLIService.java:112) ... 11 more Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1550) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:86) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:132) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:104) at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3005) at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3024) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:503) ... 13 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1548) ... 19 more Caused by: java.lang.NoSuchFieldError: METASTORE_BATCH_RETRIEVE_OBJECTS_MAX at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:207) at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:74) ... 24 more

HiveRunner occasionally throws exceptions trying to get job status

We are using a fork of your hive13-hadoop-1 branch with the following dependency changes:
hive -> hive-0.13.0
hadoop -> hdp-2.4.0 jars
No code changes.

When running our hiveRunner tests we occasionally get an error of the form:

java.io.IOException: Could not find status of job:job_local738995590_0016
at org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper.progress(HadoopJobExecHelper.java:294)
at org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper.progress(HadoopJobExecHelper.java:547)
at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:426)
at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:136)
at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:153)
at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1508)
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1275)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1093)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:916)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:906)
at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:198)
at com.klarna.hiverunner.HiveServerContainer.executeScript(HiveServerContainer.java:104)
at com.klarna.hiverunner.builder.HiveShellBase.executeScriptsUnderTest(HiveShellBase.java:202)
at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:97)

Looks like we are running into the error described in the comments of hive's HadoopJobExecHelper:
org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper:

        RunningJob newRj = jc.getJob(rj.getID());
        if (newRj == null) {
          // under exceptional load, hadoop may not be able to look up status
          // of finished jobs (because it has purged them from memory). From
          // hive's perspective - it's equivalent to the job having failed.
          // So raise a meaningful exception
          throw new IOException("Could not find status of job:" + rj.getID());

I think we might ran into an issue described in https://issues.apache.org/jira/browse/HIVE-4009.
So I've applied the patch in that ticket to the hive release-0.13.0 branch hoping that would fix things.
What the patch does is setting a boolean and skipping the block of code that causes our issue using:
org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper:

final boolean localMode = ShimLoader.getHadoopShims().isLocalMode(job);

Unfortunately I ran into an issue with HiveRunner it overrides the isLocalMode(job) in the class StandaloneHiveServerContext
com.klarna.hiverunner.StandaloneHiveServerContext:

  protected void configureJobTrackerMode(HiveConf conf) {
    /*
     * Overload shims to make sure that org.apache.hadoop.hive.ql.exec.MapRedTask#runningViaChild validates to false.
     * Search for usage of org.apache.hadoop.hive.shims.HadoopShims#isLocalMode to find other affects of this.
     */
    ReflectionUtils.setStaticField(ShimLoader.class, "hadoopShims", new Hadoop20SShims() {
      @Override
      public boolean isLocalMode(Configuration conf) {
        return false;
      }
    });
  }

Thus the pending fix in hive-1.1.0 (I know still far away from 0.13.0) won't work for HiveRunner.

Long story but my question is, did anyone run into similar problems and know of an easier way to fix this?

edit forgot to say we really like hiverunner! :)

maven central release

Hi,

Have you considered pushing releases to maven central? It will make using hiverunner much easier as we don't have to clone and build a release ourselves?

Kind regards,
Patrick

-chgrp Usage warning and NullPointerException

Getting the following NullPointerException and am unsure if it's because the group used locally is a AD group and it's having issues setting some sort of need permissions.

objc[37583]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java (0x105d0f4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x105dd74e0). One of the two will be used. Which one is undefined.
OK
-chgrp: 'XXX\XXXXXX' does not match expected pattern for group
Usage: hadoop fs [generic options] -chgrp [-R] GROUP PATH...
OK
-chgrp: 'XXX\XXXXXX' does not match expected pattern for group
Usage: hadoop fs [generic options] -chgrp [-R] GROUP PATH...
OK
select year, max(value) from source_db.test_table group by year
-chgrp: 'XXX\XXXXXX' does not match expected pattern for group
Usage: hadoop fs [generic options] -chgrp [-R] GROUP PATH...
Query ID = z001hqv_20180111124352_f9c25d0c-48d7-4438-83b7-81b3d1586424
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=
In order to set a constant number of reducers:
set mapreduce.job.reduces=
ERROR [HelloHiveRunner#testMaxValueByYear] org.apache.hadoop.hive.ql.exec.Utilities - Error caching map.xml: java.lang.NullPointerException
java.lang.NullPointerException

Hive CLI emulation does not correct model behaviours in more recent releases.

Issue #15 resulted in the introduction of a CommandLineEmulation that allowed HiveRunner to correctly represent the differing comment handling behaviors of then legacy Hive CLI and Beeline. The errant behaviours in Hive CLI HIVE-8396 have since been resolved and the CLI in Hive versions ≥ 1.3.0 now has the same behaviour as Beeline.

I believe that we should attempt to accurately model this in current versions of HiveRunner and suggest a number of possible options:

  1. Provide a further CommandLineEmulation (HIVE_CLI_PRE_130 perhaps), and update the current HIVE_CLI behaviour.
  2. Assume that HiveRunner is only concerned with more recent versions of Hive (certainly ≥ 1.3.0) and simply update the current HIVE_CLI behaviour. This would entail a small refactoring which would reduce a little code/complexity.

Note that I'm not keen to get rid of CommandLineEmulation altogether, as it is a needed abstraction for PR #74.

java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch while using hiveRunner

Hi,

I am starting to get below exception since today. In my maven build I see
"
Downloading: https://repo.maven.apache.org/maven2/com/google/guava/guava/19.0-rc2/guava-19.0-rc2.jar
Downloaded: https://repo.maven.apache.org/maven2/com/google/guava/guava/19.0-rc2/guava-19.0-rc2.jar (2257 KB at 28.0 KB/sec)
"

And here is reference to the jira that talks about this issue.
"https://issues.apache.org/jira/browse/HADOOP-10961"

Number of reduce tasks is set to 0 since there's no reduce operator
java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.()V from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:262)
at org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat.getSplits(CombineFileInputFormat.java:217)
at org.apache.hadoop.mapred.lib.CombineFileInputFormat.getSplits(CombineFileInputFormat.java:75)
at org.apache.hadoop.hive.shims.HadoopShimsSecure$CombineFileInputFormatShim.getSplits(HadoopShimsSecure.java:355)
at org.apache.hadoop.hive.shims.HadoopShimsSecure$CombineFileInputFormatShim.getSplits(HadoopShimsSecure.java:320)
at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getCombineSplits(CombineHiveInputFormat.java:418)
at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getSplits(CombineHiveInputFormat.java:509)
at org.apache.hadoop.mapreduce.JobSubmitter.writeOldSplits(JobSubmitter.java:624)
at org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(JobSubmitter.java:616)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:492)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1296)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1293)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1293)
at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:562)
at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:557)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:548)
at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:429)
at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:137)
at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604)
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:999)
at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:144)
at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:173)
at org.apache.hive.service.cli.operation.Operation.run(Operation.java:256)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:376)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:357)
at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:234)
at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:112)
at com.klarna.hiverunner.HiveServerContainer.executeScript(HiveServerContainer.java:140)
at com.klarna.hiverunner.builder.HiveShellBase.execute(HiveShellBase.java:100)
at io.hive.itests.CreateTableTest.testTablesCreated(CreateTableTest.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:176)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:64)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:91)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)

Do I have to modify anything with HiveRunner
Here's my pom that includes hiveRunner

junit
junit
4.11
test

<dependency>
  <groupId>com.klarna</groupId>
  <artifactId>hiverunner</artifactId>
  <version>2.5.1</version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <artifactId>junit</artifactId>
      <groupId>junit</groupId>
    </exclusion>
    <exclusion>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
    </exclusion>
    <exclusion>
      <artifactId>hsqldb</artifactId>
      <groupId>hsqldb</groupId>
    </exclusion>
  </exclusions>
</dependency>

Thanks

Double backslash character in for custom serde SERDEPROPERTIES causes ParseException

I am getting an exception when using a custom serde property where the value is double backslash. I have created a failing test here. We need this when providing the TSV escape character. The configuration original code we were using where this error came up looks something like this:

CREATE EXTERNAL TABLE customSerdeTable (s1 string, s2 string, s3 string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
    "separatorChar" = '\t',
    "quoteChar"     = '\u0000'
    "escapeChar"    = '\\'
)
STORED AS TEXTFILE
LOCATION '${hiveconf:hadoop.tmp.dir}/customSerde';

MSCK REPAIR TABLE customSerdeTable;

Here is the output of the failing test linked above:

java.lang.IllegalStateException: Failed to executeScript 'CREATE EXTERNAL TABLE customSerdeTable (s1 string, s2 string, s3 string)
    ROW FORMAT SERDE 'com.klarna.hiverunner.ToUpperCaseSerDe'
        WITH SERDEPROPERTIES (
            "key"="value",
            "KEY"= "VALUE",
            "key1" = "\\"
        )
        STORED AS TEXTFILE
LOCATION '${hiveconf:hadoop.tmp.dir}/customSerde';




': Failed to executeQuery Hive query CREATE EXTERNAL TABLE customSerdeTable (s1 string, s2 string, s3 string)
    ROW FORMAT SERDE 'com.klarna.hiverunner.ToUpperCaseSerDe'
        WITH SERDEPROPERTIES (
            "key"="value",
            "KEY"= "VALUE",
            "key1" = "\\"
        )
        STORED AS TEXTFILE
LOCATION '${hiveconf:hadoop.tmp.dir}/customSerde';: Error while compiling statement: FAILED: ParseException line 9:105 extraneous input ';' expecting EOF near '<EOF>'

	at com.klarna.hiverunner.builder.HiveShellBase.executeScriptsUnderTest(HiveShellBase.java:320)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:156)
	at com.klarna.hiverunner.SerdeTest.testWithCustomSerde(SerdeTest.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:174)
	at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:62)
	at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:89)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Failed to executeQuery Hive query CREATE EXTERNAL TABLE customSerdeTable (s1 string, s2 string, s3 string)
    ROW FORMAT SERDE 'com.klarna.hiverunner.ToUpperCaseSerDe'
        WITH SERDEPROPERTIES (
            "key"="value",
            "KEY"= "VALUE",
            "key1" = "\\"
        )
        STORED AS TEXTFILE
LOCATION '${hiveconf:hadoop.tmp.dir}/customSerde';: Error while compiling statement: FAILED: ParseException line 9:105 extraneous input ';' expecting EOF near '<EOF>'
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:144)
	at com.klarna.hiverunner.HiveServerContainer.executeScript(HiveServerContainer.java:156)
	at com.klarna.hiverunner.builder.HiveShellBase.executeScriptWithCommandShellEmulation(HiveShellBase.java:326)
	at com.klarna.hiverunner.builder.HiveShellBase.executeScriptsUnderTest(HiveShellBase.java:317)
	... 16 more
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 9:105 extraneous input ';' expecting EOF near '<EOF>'
	at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:315)
	at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:112)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:181)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:257)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:388)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:369)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:261)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	... 19 more
Caused by: org.apache.hadoop.hive.ql.parse.ParseException: line 9:105 extraneous input ';' expecting EOF near '<EOF>'
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:213)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:396)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:308)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1122)
	at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1116)
	at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:110)
	... 25 more

Aggregate functions with Views

Hi,

I've been having a rather unusual problem involving using an aggregate function, storing the result in a view, and then accessing the data in that view.

I have the following two queries, which I run in sequence:

CREATE VIEW db.latestnodemvtchanges AS
SELECT testid, hostname, max(`timestamp`) AS mts
FROM db.mvtdescriptionchangeinfo
WHERE `timestamp` IS NOT NULL
GROUP BY testid, hostname;
CREATE VIEW db.latesttestchangepairs AS
SELECT a.testid, a.type
FROM db.mvtdescriptionchangeinfo a
INNER JOIN db.latestnodemvtchanges b ON a.testid = b.testid AND a.`timestamp` = b.mts
GROUP BY a.testid, a.type;

And check the result using:

SELECT * FROM db.latesttestchangepairs

and to set this all up, beforehand I execute:

CREATE DATABASE db;

CREATE EXTERNAL TABLE `db.mvtdescriptionchangeinfo`(
  `timestamp` bigint COMMENT '',
  `testid` string COMMENT '',
  `type` string COMMENT '',
  `contents` string COMMENT '',
  `hostname` string COMMENT '')
PARTITIONED BY (
  `request_log_date` string,
  `request_log_hour` string)

My problem is as follows: when I unit test the first query it behaves exactly as expected, finding the maximum timestamp and filtering the others out accordingly. The second query also does what it's supposed to when tested by itself.

However, when I combine the two, something strange happens - the line a.`timestamp` = b.mts stops working as it should. Even when I have one row in both tables that the query accesses, with identical timestamps, the condition a.`timestamp` = b.mts doesn't return true and as a consequence nothing is returned. When I remove this condition the join works as expected.

The test input to db.mvtdescriptionchangeinfo I use is:
123 testname REMOVED "contents of test..." hostname 6/21/17 20

The output I should get is:
testname REMOVED

but instead nothing is returned.

I've traced this back to the max(`timestamp`) aggregate function in the first query. It seems to be causing the issue, as when I simply replace it with the timestamp value '123' (which is what max(`timestamp`) should return), everything works.

Again, when I replace a.`timestamp` = b.mts in the second query with a.`timestamp` = 123 then it works as I would expect, and even when I replace that same line with 123 = b.mts it all works as expected. It's just comparing them to each other which causes this to fail.

I really can't figure out why this would happen. My hunch is that it might be something to do with the way that views calculate aggregate functions. Why this would happen because of something in HiveRunner I'm not sure, and having run this on an actual hive test server everything worked. Still, the problem persists, so I thought I'd let you know and hopefully you can reproduce and diagnose it.

I hope that's enough information about the problem. Let me know how else I can help with this. Thanks!

How to run test on Hadoop Cluster

hi Guys,

I am trying to use this tool to write the unit test for my hive SQL and it's working as expected when I run on local machine. However, I would like to understand how to run this test on my existing hadoop cluster.
is there any configuration change I need to make so that it runs on exiting cluster and use exiting HDFS.

Hive Runner on Windows using Cygwin

Getting below exception while running hiverunner on Windows:
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:172)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:64)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:91)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
at java.lang.Thread.run(Thread.java:745)

However the test runs successfully on Mac. I have installed Cygwin. Please guide on how to utlize Cygwin to work with Hiverunner.

HDP2.6.3_3.3.0-SNAPSHOT and transaction

Hello

I use a HiveRunner version HDP2.6.3_3.3.0-SNAPSHOT to make a test for HDP
Everything works ok.

Now I have to make a test for schema with transactional tables, so I try to enable transactions in the Hive.

According to:
https://cwiki.apache.org/confluence/display/Hive/Hive+Transactions
https://community.hortonworks.com/questions/37519/how-to-activate-acid-transactions-in-hive-within-h.html

I changed setings:

<hiveconf_hive.compactor.initiator.on>true</hiveconf_hive.compactor.initiator.on>
<hiveconf_hive.compactor.worker.threads>1</hiveconf_hive.compactor.worker.threads>

<hiveconf_hive.support.concurrency>true</hiveconf_hive.support.concurrency>
<hiveconf_hive.enforce.bucketing>true</hiveconf_hive.enforce.bucketing>
<hiveconf_hive.exec.dynamic.partition.mode>nonstrict</hiveconf_hive.exec.dynamic.partition.mode>
<hiveconf_hive.txn.manager>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</hiveconf_hive.txn.manager>

and i enabled a pooling:
<hiveconf_datanucleus.connectionPoolingType>BoneCP</hiveconf_datanucleus.connectionPoolingType>

Unfortunate I have an error like below, seems like part od metastore schema responsible for transactio was not created or transaction manager can not access them.

Any idea how to solve this problem, how to enable a transaction in HiveRunner?


[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.xxxx.yyyyy.zzzzz
INFO    [#]    org.apache.hadoop.hive.metastore.txn.TxnHandler    - START========"HiveConf()"========
........long dump of hive params......
END========"new HiveConf()"========

DEBUG   [#]    org.apache.hadoop.hive.metastore.txn.TxnHandler    - Going to execute query <select nl_next from NEXT_LOCK_ID>
DEBUG   [#]    org.apache.hadoop.hive.metastore.txn.TxnHandler    - Going to rollback
INFO    [#]    org.apache.hadoop.hive.metastore.txn.TxnHandler    - Non-retryable error in enqueueLockWithRetry(LockRequest(component:[LockComponent(type:SHARED_READ, level:DB, dbname:default, operationType:SELECT)], txnid:0, user:m.z, hostname:mar, agentInfo:m.z_20180129001153_bd9d71df-a346-40bb-9da9-36e3c245ce9c)) : Table/View 'NEXT_LOCK_ID' does not exist. (SQLState=42X05, ErrorCode=20000)
ERROR   [#]    org.apache.hadoop.hive.metastore.RetryingHMSHandler    - MetaException(message:Unable to update transaction database java.sql.SQLSyntaxErrorException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
	at com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:464)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.enqueueLockWithRetry(TxnHandler.java:972)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:894)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:6155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:105)
	at com.sun.proxy.$Proxy21.lock(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:1977)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:178)
	at com.sun.proxy.$Proxy22.lock(Unknown Source)
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:102)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:357)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:373)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:182)
	at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:1082)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1284)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
	at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:197)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:230)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:448)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:270)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:211)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:107)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
Caused by: java.sql.SQLException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 65 more
Caused by: ERROR 42X05: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
	... 59 more
)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.enqueueLockWithRetry(TxnHandler.java:1102)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:894)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:6155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:105)
	at com.sun.proxy.$Proxy21.lock(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:1977)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:178)
	at com.sun.proxy.$Proxy22.lock(Unknown Source)
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:102)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:357)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:373)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:182)
	at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:1082)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1284)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
	at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:197)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:230)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:448)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:270)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:211)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:107)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)

FAILED: Error in acquiring locks: Error communicating with the metastore
ERROR   [#]    org.apache.hadoop.hive.ql.Driver    - FAILED: Error in acquiring locks: Error communicating with the metastore
org.apache.hadoop.hive.ql.lockmgr.LockException: Error communicating with the metastore
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:177)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:357)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:373)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:182)
	at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:1082)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1284)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
	at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:197)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:230)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:448)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:270)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:211)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:107)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
Caused by: MetaException(message:Unable to update transaction database java.sql.SQLSyntaxErrorException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
	at com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:464)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.enqueueLockWithRetry(TxnHandler.java:972)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:894)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:6155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:105)
	at com.sun.proxy.$Proxy21.lock(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:1977)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:178)
	at com.sun.proxy.$Proxy22.lock(Unknown Source)
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:102)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:357)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:373)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:182)
	at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:1082)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1284)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
	at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:197)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:230)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:448)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:270)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:211)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:107)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
Caused by: java.sql.SQLException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 65 more
Caused by: ERROR 42X05: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
	... 59 more
)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.enqueueLockWithRetry(TxnHandler.java:1102)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:894)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:6155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:105)
	at com.sun.proxy.$Proxy21.lock(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:1977)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:178)
	at com.sun.proxy.$Proxy22.lock(Unknown Source)
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:102)
	... 38 more

OK
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.927 s <<< FAILURE! - in com.com.xxxx.yyyyy.zzzzz
[ERROR] com.com.xxxx.yyyyy.zzzzz  Time elapsed: 16.924 s  <<< ERROR!
java.lang.IllegalArgumentException: Failed to executeQuery Hive query SHOW TABLES: Error while processing statement: FAILED: Error in acquiring locks: Error communicating with the metastore
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while processing statement: FAILED: Error in acquiring locks: Error communicating with the metastore
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
Caused by: org.apache.hadoop.hive.ql.lockmgr.LockException: Error communicating with the metastore
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
Caused by: org.apache.hadoop.hive.metastore.api.MetaException: 
Unable to update transaction database java.sql.SQLSyntaxErrorException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
	at com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:464)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.enqueueLockWithRetry(TxnHandler.java:972)
	at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:894)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:6155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:105)
	at com.sun.proxy.$Proxy21.lock(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:1977)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:178)
	at com.sun.proxy.$Proxy22.lock(Unknown Source)
	at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:102)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:357)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:373)
	at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:182)
	at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:1082)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1284)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
	at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:197)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:230)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:448)
	at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:270)
	at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:117)
	at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:211)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:107)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
Caused by: java.sql.SQLException: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 65 more
Caused by: ERROR 42X05: Table/View 'NEXT_LOCK_ID' does not exist.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
	... 59 more

	at com.com.xxxx.yyyyy.zzzzz.setUpBeforeClass(HiveStaticSuite.java:173)

'source' syntax is not working

In a hive script i have source statement but it looks like at current HiveRunner is not supporting..
It will be nice to support this.

Failed to compile with Hive 2.1.0

I tried to compile project with Hive 2.1.0.
Got

ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /HiveRunner/src/main/java/com/klarna/hiverunner/HiveServerContainer.java:[23,39] cannot find symbol
symbol: class VariableSubstitution
location: package org.apache.hadoop.hive.ql.parse
[ERROR] /HiveRunner/src/main/java/com/klarna/hiverunner/HiveServerContainer.java:[202,12] cannot find symbol
symbol: class VariableSubstitution
location: class com.klarna.hiverunner.HiveServerContainer
[INFO] 2 errors

Re-use Metastore across test methods to improve performance

Hello,

I've recently started to use HiveRunner and so far I'm really impressed, thank you for all your efforts on it!

I have one question regarding performance of unit tests. Currently I have one test class containing 10 unit tests - execution of those takes a very long time at the moment. I read somewhere that a new metastore is spun up for every unit test which is causing the long runtime.
Would it be possible to change a setting or something else so that it is only spun up once for my test class?

Thanks!

HIveRunner keeps failing

I keep getting the below error and could not find which jar im skipping. I'm not able to find the below class in ay of jar.

2016-04-05 08:59:59 DEBUG HiveServerContainer : 173 - org/apache/hadoop/fs/FSDataInputStream$FadviseType
java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream$FadviseType
at org.apache.hadoop.mapred.LineRecordReader.close(LineRecordReader.java:284)

javax.jdo.JDOFatalInternalException: Unexpected exception caught.

Hi,
I am using hiveRunner (2.5.1). When I replaced my set of queries inside HelloHiveRunner example they worked nicely.
Now I am reusing HelloHiveRunner example in my project and provided necessary .sql and .csv files.

When I start running the test I get below exception:

15/11/26 13:16:11 INFO hiverunner.StandaloneHiveRunner: Setting up io.hive.HelloHiveRunner in /tmp/junit661990843870432294
15/11/26 13:16:12 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
15/11/26 13:16:12 INFO metastore.ObjectStore: ObjectStore, initialize called
15/11/26 13:16:12 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
15/11/26 13:16:12 INFO DataNucleus.Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
15/11/26 13:16:12 WARN metastore.HiveMetaStore: Retrying creating default database after error: Unexpected exception caught.
javax.jdo.JDOFatalInternalException: Unexpected exception caught.
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1193)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:340)
at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:369)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:266)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:233)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.hive.metastore.RawStoreProxy.(RawStoreProxy.java:56)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:65)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:560)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:538)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:587)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:429)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:66)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:72)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:5554)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.(HiveMetaStoreClient.java:178)
at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.(SessionHiveMetaStoreClient.java:73)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1447)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.(RetryingMetaStoreClient.java:63)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2661)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2680)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
at org.apache.hive.service.cli.session.SessionManager.applyAuthorizationConfigPolicy(SessionManager.java:124)
at org.apache.hive.service.cli.session.SessionManager.init(SessionManager.java:80)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.cli.CLIService.init(CLIService.java:107)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.server.HiveServer2.init(HiveServer2.java:89)
at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:80)
at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:108)
at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:222)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:175)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:64)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:91)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
at java.lang.Thread.run(Thread.java:745)
NestedThrowablesStackTrace:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:340)
at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:369)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:266)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:233)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.hive.metastore.RawStoreProxy.(RawStoreProxy.java:56)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:65)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:560)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:538)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:587)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:429)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:66)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:72)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:5554)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.(HiveMetaStoreClient.java:178)
at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.(SessionHiveMetaStoreClient.java:73)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1447)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.(RetryingMetaStoreClient.java:63)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2661)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2680)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
at org.apache.hive.service.cli.session.SessionManager.applyAuthorizationConfigPolicy(SessionManager.java:124)
at org.apache.hive.service.cli.session.SessionManager.init(SessionManager.java:80)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.cli.CLIService.init(CLIService.java:107)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.server.HiveServer2.init(HiveServer2.java:89)
at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:80)
at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:108)
at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:222)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:175)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:64)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:91)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:149)
at org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:121)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:501)
at org.datanucleus.store.rdbms.RDBMSStoreManager.(RDBMSStoreManager.java:298)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:631)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1187)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:333)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
... 52 more
15/11/26 13:16:12 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
15/11/26 13:16:12 INFO metastore.ObjectStore: ObjectStore, initialize called
15/11/26 13:16:13 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
15/11/26 13:16:13 INFO DataNucleus.Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored

java.lang.IllegalStateException: Failed to create HiveServer :java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:97)
at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:108)
at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:222)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:175)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:64)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:91)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:444)
at org.apache.hive.service.cli.session.SessionManager.applyAuthorizationConfigPolicy(SessionManager.java:124)
at org.apache.hive.service.cli.session.SessionManager.init(SessionManager.java:80)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.cli.CLIService.init(CLIService.java:107)
at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
at org.apache.hive.service.server.HiveServer2.init(HiveServer2.java:89)
at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:80)
... 8 more
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1449)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.(RetryingMetaStoreClient.java:63)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2661)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2680)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1447)
... 20 more
Caused by: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1193)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:340)
at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:369)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:266)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:233)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.hive.metastore.RawStoreProxy.(RawStoreProxy.java:56)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:65)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:560)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:538)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:591)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:429)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:66)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:72)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:5554)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.(HiveMetaStoreClient.java:178)
at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.(SessionHiveMetaStoreClient.java:73)
... 25 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
... 44 more
Caused by: java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:149)
at org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:121)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:501)
at org.datanucleus.store.rdbms.RDBMSStoreManager.(RDBMSStoreManager.java:298)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:631)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1187)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:333)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
... 52 more

Process finished with exit code 255

Can you please help, Any setting am i missing?
I am using hive 0.14.0 and hadoop 2.7.1

Does default hiveRunner example run with different hadoop versions?

SemanticException End of a WindowFrame cannot be UNBOUNDED PRECEDING

Hi Team,
Can you update the hive version used from 0.10.0 to latest

its not supporting the below:
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException End of a WindowFrame cannot be UNBOUNDED PRECEDING and many other data analytics

With Regards,
Charavana

Parquet Support

This might be an issue with the Hive version being 0.14, but is "STORED AS PARQUET" allowed as an option when creating tables?

If I use parquet format, I get the following,

java.lang.RuntimeException: Should never be used
	at org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat.getRecordWriter(MapredParquetOutputFormat.java:76)
	at org.apache.hive.hcatalog.mapreduce.FileOutputFormatContainer.getRecordWriter(FileOutputFormatContainer.java:102)
	at org.apache.hive.hcatalog.mapreduce.HCatOutputFormat.getRecordWriter(HCatOutputFormat.java:260)
	at org.apache.hive.hcatalog.data.transfer.impl.HCatOutputFormatWriter.write(HCatOutputFormatWriter.java:95)
	at com.klarna.hiverunner.data.TableDataInserter.insert(TableDataInserter.java:48)
	at com.klarna.hiverunner.data.TableDataInserter.insert(TableDataInserter.java:33)
	at com.klarna.hiverunner.data.InsertIntoTable.commit(InsertIntoTable.java:188)
	at com.apple.hivetests.HiveTest.setupTargetDatabase(HiveTest.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:177)
	at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:65)
	at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:92)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
	at java.lang.Thread.run(Thread.java:748)

removing this and using ORC format works fine.

Support headers in TSVFileParser

It would be really neat if I could use insertInto with TsvFileParser where only a few columns were specified and hence selected as now done with withColumns.

My use case is where I have a lot of tests that all have different csv input files where not all columns are needed. When I do schema changes I would preferrably only like to change the tests that are affected and not have a lot of empty values. To know which columns are used in which CSV it is easiest to have a header which is currently not supported.

ERROR hiverunner.StandaloneHiveRunner Failed to set permissions of path: C:\ to 0700

When running unit test, encountered following error message:
ocalscratchdir\hive_2014-07-02_16-00-01_009_6895163325323467224-1 to 0700
java.lang.IllegalStateException: Failed to ping HiveServer: Query returned non-zero code: 40000, cause: FAILED: RuntimeException java.io.IOException: Failed to set permissions of path: C:\cygwin64\tmp\junit7581111814416842686\localscratchdir\hive_2014-07-02_16-00-01_009_6895163325323467224-1 to 0700
at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:149)
at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:74)
at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:92)
at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:138)
at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:95)
at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:49)
at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:75)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: HiveServerException(message:Query returned non-zero code: 40000, cause: FAILED: RuntimeException java.io.IOException: Failed to set permissions of path: C:\cygwin64\tmp\junit7581111814416842686\localscratchdir\hive_2014-07-02_16-00-01_009_6895163325323467224-1 to 0700, errorCode:40000, SQLState:42000)
at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:219)
at com.klarna.hiverunner.HiveServerContainer.pingHiveServer(HiveServerContainer.java:147)

3.2.1 release to maven repository

Since 3.2.1 fixes the windows issue and it's been in the repository for some time, I'm curious when would this be published to the maven repository?
Great work and thanks for this btw!

HiveServerException

This might be a existing issue: I see this error often and i believe its related to hadoop process being being interrupted. Is there a workaround for this. Help is much appreciated.

Caused by: HiveServerException(message:Query returned non-zero code: 1, cause: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.RuntimeException: Error while running command to get file permissions : java.io.IOException: java.lang.InterruptedException

Abstraction is not working

I try to build an AbstractHiveTest. But I can't use @HiveSQL annotation in abstract class. I get error such as;

java.lang.IllegalArgumentException: Failed to set field 'hiveShell' on 'com.bird.dwh.hadoop.hive.insertfact.InsertFactLocation2Test@213f8326': hiveShell

Here is some part of my abstract class;

@RunWith(StandaloneHiveRunner.class)
public abstract class AbstractHiveTest {

    @HiveSQL(files = {}, autoStart = false)
    HiveShellContainer hiveShell;

    ...

I follow the trace and I got somewhere that retrieves declared fields of child test classes. It only looks for child class fields to set hiveShell. I guess there should be a part missing to look into super class fields.

https://github.com/klarna/HiveRunner/blob/master/src/main/java/com/klarna/reflection/ReflectionUtils.java#L47

In here, there should also be something like I guess;

Field field = clazz.getSuperclass().getDeclaredFields()

Case-insensitive bug fix

There was a bug which meant that if a file contained an uppercase letter in the column name, it wouldn't register that it was the same name as the column in the table to add the data to, as they are read as lower-case names.
I fixed this by converting the names from the file to lower case when they are read in, in the following PR; https://github.com/klarna/HiveRunner/pull/72

Access to ResultSet or ResultSetMetaData

Hi,

Thanks so much for all of the work on HiveRunner, it's been fantastic.

At the moment I'm attempting to write a spec that looks at the format of the results. For this I think I need the ResultSetMetaData which usually comes from the ResultSet on a JDBC connection. I see that RowSet is used within HiveServerContainer that comes from the CLIService. Do you know if it would be possible to get a ResultSet or ResultSetMetaData?

Thanks,

Theo

Parsing of scripts containing full-line comments fails.

I believe there may be a bug in StatementsSplitter when parsing lines that contain only a comment, that are then followed by an expression. The following test fails but I believe it should pass:

@Test
public void testSingleLineComment() {
  String str = "-- force next step to use a single reducer\nset mapred.reduce.tasks=1";
  List expected = Arrays.asList(
    "-- force next step to use a single reducer",
    "set mapred.reduce.tasks=1"
  );
  Assert.assertEquals(expected, StatementsSplitter.splitStatements(str));
}

This is interpreted as the single statement:

-- force next step to use a single reducer\nset mapred.reduce.tasks=1

And fails with:

FAILED: ParseException line 2:4 missing KW_ROLE at 'mapred' near 'mapred'
line 2:10 missing EOF at '.' near 'mapred'
22920 [Thread-0] ERROR org.apache.hadoop.hive.ql.Driver  - FAILED: ParseException line 2:4 missing KW_ROLE at 'mapred' near 'mapred'
line 2:10 missing EOF at '.' near 'mapred'
org.apache.hadoop.hive.ql.parse.ParseException: line 2:4 missing KW_ROLE at 'mapred' near 'mapred'
line 2:10 missing EOF at '.' near 'mapred'
    at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:210)

NoSuchFieldError: doubleTypeInfo

Hello,

I am currently getting a NoSuchFieldError for doubleTypeInfo when creating an external table with fields of type DOUBLE:

CREATE EXTERNAL TABLE IF NOT EXISTS <db_name.table_name> (
    name STRING,
    avgrating DOUBLE
): Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. doubleTypeInfo

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. doubleTypeInfo
ERROR [2017-04-06 15:17:45,762] hive.ql.exec.DDLTask: java.lang.NoSuchFieldError: doubleTypeInfo

Any advice is appreciated. Thanks.

Running tests on OSX Sierra is very very slow

Currently I just upgrade my MacBook from El Capitan to Sierra. Suddenly my HiveRunner tests are running very very slow. Usually 5 tests only took 40 seconds, now need 8 mins. And I keep getting this error message in the console output:

com.klarna.hiverunner.ThrowOnTimeout - Test ran for 30 seconds. Timeout disabled. See class com.klarna.hiverunner.config.HiveRunnerConfig for configuration options.

Anyone has the same issue and how to solve it?

Thanks

Hive can do unit testing with hbase?

hi,Hiverunnner is able to unit test with hbase? if it can ,how to configure unit test hbase.
here is the hive table with hbase :
CREATE TABLE test_hive_hbase (
key string COMMENT '',
teststr int COMMENT '')
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES (
'hbase.columns.mapping'=':key,teststr:1')
TBLPROPERTIES ('hbase.table.name'='test_hbase')

java.lang.NoSuchMethodError: org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy

When i am using hiverunner(3.0.0) and running the test, I meet some exception like this:

java.lang.NoSuchMethodError: org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(Lorg/apache/hadoop/hive/conf/HiveConf;Lorg/apache/hadoop/hive/metastore/HiveMetaHookLoader;Ljava/util/Map;Ljava/lang/String;)Lorg/apache/hadoop/hive/metastore/IMetaStoreClient;
	at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3005)
	at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3024)
	at org.apache.hadoop.hive.ql.metadata.Hive.getAllDatabases(Hive.java:1234)
	at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:174)
	at org.apache.hadoop.hive.ql.metadata.Hive.<clinit>(Hive.java:166)
	at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:503)
	at org.apache.hive.service.cli.CLIService.applyAuthorizationConfigPolicy(CLIService.java:125)
	at org.apache.hive.service.cli.CLIService.init(CLIService.java:110)
	at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
	at org.apache.hive.service.server.HiveServer2.init(HiveServer2.java:129)
	at com.klarna.hiverunner.HiveServerContainer.init(HiveServerContainer.java:85)
	at com.klarna.hiverunner.builder.HiveShellBase.start(HiveShellBase.java:150)
	at com.klarna.hiverunner.StandaloneHiveRunner.createHiveServerContainer(StandaloneHiveRunner.java:224)
	at com.klarna.hiverunner.StandaloneHiveRunner.evaluateStatement(StandaloneHiveRunner.java:176)
	at com.klarna.hiverunner.StandaloneHiveRunner.access$000(StandaloneHiveRunner.java:65)
	at com.klarna.hiverunner.StandaloneHiveRunner$1$1.evaluate(StandaloneHiveRunner.java:92)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at com.klarna.hiverunner.ThrowOnTimeout$1.run(ThrowOnTimeout.java:42)
	at java.lang.Thread.run(Thread.java:745)

Can anybody help resolve this exception? Thanks

Create view

Hi, I have a hql script where I create a View, but when I execute this script I receive an error. HiveRunner supports Views Objects?

Here my code

    @HiveSQL(files = {
        "scripts/one.hql",
        "scripts/two.hql",
        "scripts/three.hql" }, autoStart = false)
private HiveShell hiveShell;



@Before
public void before() {
    hiveShell.addSetupScript("create database cdeexp");
    hiveShell.addSetupScript("create database rdmexp");
    hiveShell.setHiveConfValue("var", "${hiveconf:hadoop.tmp.dir}");
    hiveShell.setHiveConfValue("PATH_AMBIENTE", "${hiveconf:hadoop.tmp.dir}");
    hiveShell.start();
    hiveShell.executeQuery("use cdeexp");
}

   @Test
public void testview() {
    hiveShell.executeQuery("use rdmexp");

    hiveShell.execute(new File("src/main/hive/ddl/vistas/view.hql"));

    String tabla = "view";
    List<String> actual = hiveShell.executeQuery("show tables like '"+ tabla + "'");
    Assert.assertEquals(actual.get(0), tabla);
}

The error occurs when hiverunner execute the hive.hql (testview method). The script view.hql contains join between the first tables.

Thanks for your help,

ERROR with CTE names

I'm using hiverunner 3.0.0.
The following query fails if there's an uppercase letter in cteName in the select * clause, regardless of whether or not there's an uppercase in cteName in WITH clause.
To illustrate,

CASE 1:

hiveShell.executeQuery(
      """
        |WITH cteName as
        |  (SELECT someColumn
        |   FROM someTable
        |   WHERE someCondition
        |  )
        |SELECT *
        |FROM cteName
      """.stripMargin)

It fails.

CASE 2:

hiveShell.executeQuery(
      """
        |WITH ctename as
        |  (SELECT someColumn
        |   FROM someTable
        |   WHERE someCondition
        |  )
        |SELECT *
        |FROM ctename
      """.stripMargin)

Succeeds.

CASE 3:

hiveShell.executeQuery(
      """
        |WITH cteName as
        |  (SELECT someColumn
        |   FROM someTable
        |   WHERE someCondition
        |  )
        |SELECT *
        |FROM ctename
      """.stripMargin)

Succeeds.

Using hive and beeline:
The query succeeds in all cases.

Here's the stack trace:

java.lang.AssertionError
at org.apache.hadoop.hive.ql.parse.QB.rewriteViewToSubq(QB.java:237)
at org.apache.hadoop.hive.ql.parse.QB.rewriteCTEToSubq(QB.java:242)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.addCTEAsSubQuery(SemanticAnalyzer.java:1008)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1492)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1449)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genResolvedParseTree(SemanticAnalyzer.java:10205)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10256)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10141)
at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:222)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:432)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:305)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1119)
at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1112)
at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:99)
at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:170)
at org.apache.hive.service.cli.operation.Operation.run(Operation.java:268)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:410)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:391)
at org.apache.hive.service.cli.CLIService.executeStatement(CLIService.java:245)
at com.klarna.hiverunner.HiveServerContainer.executeStatement(HiveServerContainer.java:112)
at com.klarna.hiverunner.builder.HiveShellBase.executeStatementWithCommandShellEmulation(HiveShellBase.java:103)
at com.klarna.hiverunner.builder.HiveShellBase.executeStatement(HiveShellBase.java:99)
at com.klarna.hiverunner.builder.HiveShellBase.executeQuery(HiveShellBase.java:89)
at com.klarna.hiverunner.builder.HiveShellBase.executeQuery(HiveShellBase.java:82)

Error when running in Local Mode

Hey There,

I was exploring your awesome project for doing Hive unit testing. While running with LocalModeHiveRunner, I am getting the below error. It seems the hive classpath is not appended to Hadoop. I didn't find any example of LocalModeHiveRunner in the project also. Anything I am missing here? Thanks.

4/03/13 12:15:46 INFO exec.Task: set mapred.reduce.tasks=
14/03/13 12:15:46 INFO mr.ExecDriver: Generating plan file file:/tmp/junit2452254900258304223/localscratchdir/hive_2014-03-13_12-15-46_269_9103258877342561165-1/-local-10003/plan.xml
14/03/13 12:15:46 INFO exec.Utilities:
14/03/13 12:15:46 INFO exec.Utilities: </PERFLOG method=serializePlan start=1394693146664 end=1394693146888 duration=224>
14/03/13 12:15:46 INFO mr.ExecDriver: Executing: /usr/bin/hadoop jar /home/jabong/.m2/repository/org/apache/hive/hive-common/0.12.0/hive-common-0.12.0.jar org.apache.hadoop.hive.ql.exec.mr.ExecDriver -plan file:/tmp/junit2452254900258304223/localscratchdir/hive_2014-03-13_12-15-46_269_9103258877342561165-1/-local-10003/plan.xml -jobconffile file:/tmp/junit2452254900258304223/localscratchdir/hive_2014-03-13_12-15-46_269_9103258877342561165-1/-local-10002/jobconf.xml
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.exec.mr.ExecDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.main(RunJar.java:201)
Execution failed with exit status: 1
14/03/13 12:15:47 ERROR exec.Task: Execution failed with exit status: 1
Obtaining error information
14/03/13 12:15:47 ERROR exec.Task: Obtaining error information

Task failed!
Task ID:
Stage-1

Logs:

14/03/13 12:15:47 ERROR exec.Task:
Task failed!
Task ID:
Stage-1

Issue reading from Avro files when using insertInto feature

We are running into an issue when reading from an avro backed table. Here are the sequence of events:

  1. Create avro backed table
  2. Insert data into it using the InsertInto feature
  3. Read from avro table -> Raises a schema mismatch error.

Here is the how the code looks like:

	shell.insertInto(schemaName, tableName)
    	 .withAllColumns()
    	 .addRowsFromDelimited(f, "\t", "NULL")
    	 .commit();

What is interesting is, if I write to the table with shell.execute("Insert into table Values(...)"), the error does not pop up. So it looks like a bug on the addRowsFromDelimited feature.

This does not happen with other table formats (eg: orc), only avro.

Here is the stack trace:

HiveException: java.io.IOException: org.apache.avro.AvroTypeException: Found dummy_avro_table, expecting dummy_avro_table
at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:171)
at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.run(TezProcessor.java:137)
at org.apache.tez.runtime.LogicalIOProcessorRuntimeTask.run(LogicalIOProcessorRuntimeTask.java:337)
at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable$1.run(TezTaskRunner.java:179)
at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable$1.run(TezTaskRunner.java:171)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable.callInternal(TezTaskRunner.java:171)
at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable.callInternal(TezTaskRunner.java:167)
at org.apache.tez.common.CallableWithNdc.call(CallableWithNdc.java:36)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.