diff --git .gitignore .gitignore
index 4d341a0..47c59da 100644
--- .gitignore
+++ .gitignore
@@ -27,4 +27,5 @@ hcatalog/webhcat/java-client/target
hcatalog/storage-handlers/hbase/target
hcatalog/webhcat/svr/target
conf/hive-default.xml.template
+itests/hive-blobstore/src/test/resources/blobstore-conf.xml
.DS_Store
diff --git data/conf/blobstore/hive-site.xml data/conf/blobstore/hive-site.xml
new file mode 100644
index 0000000..4702a93
--- /dev/null
+++ data/conf/blobstore/hive-site.xml
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+ hive.in.test
+ true
+ Internal marker for test. Used for masking env-dependent values
+
+
+
+
+
+
+
+
+
+
+ hadoop.tmp.dir
+ ${test.tmp.dir}/hadoop-tmp
+ A base for other temporary directories.
+
+
+
+
+
+ hive.exec.scratchdir
+ ${test.tmp.dir}/scratchdir
+ Scratch space for Hive jobs
+
+
+
+ hive.exec.local.scratchdir
+ ${test.tmp.dir}/localscratchdir/
+ Local scratch space for Hive jobs
+
+
+
+ local.tmp.dir
+ file:///${env:PWD}/target/tmp
+
+
+
+ datanucleus.schema.autoCreateAll
+ true
+
+
+
+ hive.metastore.schema.verification
+ false
+
+
+
+ javax.jdo.option.ConnectionURL
+ jdbc:derby:;databaseName=${test.tmp.dir}/junit_metastore_db;create=true
+
+
+
+ hive.stats.dbconnectionstring
+ jdbc:derby:;databaseName=${test.tmp.dir}/TempStatsStore;create=true
+
+
+
+ javax.jdo.option.ConnectionDriverName
+ org.apache.derby.jdbc.EmbeddedDriver
+
+
+
+ javax.jdo.option.ConnectionUserName
+ APP
+
+
+
+ javax.jdo.option.ConnectionPassword
+ mine
+
+
+
+
+ hive.metastore.warehouse.dir
+ ${test.warehouse.dir}
+
+
+
+
+ hive.metastore.metadb.dir
+ file://${test.tmp.dir}/metadb/
+
+ Required by metastore server or if the uris argument below is not supplied
+
+
+
+
+ test.log.dir
+ ${test.tmp.dir}/log/
+
+
+
+
+ test.data.files
+ ${hive.root}/data/files
+
+
+
+
+ test.data.scripts
+ ${basedir}/src/test/data/scripts
+
+
+
+
+ hive.jar.path
+ ${maven.local.repository}/org/apache/hive/hive-exec/${hive.version}/hive-exec-${hive.version}.jar
+
+
+
+
+ hive.metastore.rawstore.impl
+ org.apache.hadoop.hive.metastore.ObjectStore
+ Name of the class that implements org.apache.hadoop.hive.metastore.rawstore interface. This class is used to store and retrieval of raw metadata objects such as table, database
+
+
+
+ hive.querylog.location
+ ${test.tmp.dir}/tmp
+ Location of the structured hive logs
+
+
+
+ hive.exec.pre.hooks
+ org.apache.hadoop.hive.ql.hooks.PreExecutePrinter, org.apache.hadoop.hive.ql.hooks.EnforceReadOnlyTables
+ Pre Execute Hook for Tests
+
+
+
+ hive.exec.post.hooks
+ org.apache.hadoop.hive.ql.hooks.PostExecutePrinter
+ Post Execute Hook for Tests
+
+
+
+ hive.support.concurrency
+ true
+ Whether hive supports concurrency or not. A zookeeper instance must be up and running for the default hive lock manager to support read-write locks.
+
+
+
+ hive.unlock.numretries
+ 2
+ The number of times you want to retry to do one unlock
+
+
+
+ hive.lock.sleep.between.retries
+ 2
+ The sleep time (in seconds) between various retries
+
+
+
+ fs.pfile.impl
+ org.apache.hadoop.fs.ProxyLocalFileSystem
+ A proxy for local file system used for cross file system testing
+
+
+
+ hive.exec.mode.local.auto
+ false
+
+ Let hive determine whether to run in local mode automatically
+ Disabling this for tests so that minimr is not affected
+
+
+
+
+ hive.auto.convert.join
+ false
+ Whether Hive enable the optimization about converting common join into mapjoin based on the input file size
+
+
+
+ hive.ignore.mapjoin.hint
+ false
+ Whether Hive ignores the mapjoin hint
+
+
+
+ hive.input.format
+ org.apache.hadoop.hive.ql.io.CombineHiveInputFormat
+ The default input format, if it is not specified, the system assigns it. It is set to HiveInputFormat for hadoop versions 17, 18 and 19, whereas it is set to CombineHiveInputFormat for hadoop 20. The user can always overwrite it - if there is a bug in CombineHiveInputFormat, it can always be manually set to HiveInputFormat.
+
+
+
+ hive.default.rcfile.serde
+ org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe
+ The default SerDe hive will use for the rcfile format
+
+
+
+ hive.stats.key.prefix.reserve.length
+ 0
+
+
+
+ hive.conf.restricted.list
+ dummy.config.value
+ Using dummy config value above because you cannot override config with empty value
+
+
+
+ hive.exec.submit.local.task.via.child
+ false
+
+
+
+ hive.optimize.sort.dynamic.partition
+ true
+
+
+
+ hive.dummyparam.test.server.specific.config.override
+ from.hive-site.xml
+ Using dummy param to test server specific configuration
+
+
+
+ hive.dummyparam.test.server.specific.config.hivesite
+ from.hive-site.xml
+ Using dummy param to test server specific configuration
+
+
+
+ hive.fetch.task.conversion
+ minimal
+
+
+
+ hive.users.in.admin.role
+ hive_admin_user
+
+
diff --git itests/hive-blobstore/README itests/hive-blobstore/README
new file mode 100644
index 0000000..b362836
--- /dev/null
+++ itests/hive-blobstore/README
@@ -0,0 +1,19 @@
+The folder structure details are:
+
+ * ./src/test/queries - contains the queries to be tested on s3
+ * ./src/test/results - contains the expected hive console output for the queries
+ * ./target/qfile-results - Hive console output goes here
+ * ../../data/conf/blobstore/ - contains hive-site.xml
+
+To run blobstore integration tests:
+
+ 1. Create blobstore-conf.xml in ./src/test/resources/ with the blobstore credentials (see blobstore-conf.xml.template).
+
+ 2. Run following command:
+ mvn test -Dtest=TestBlobstore[Negative]CliDriverS3 -Dtest.blobstore.path=s3://my-bucket/hive/s3/it/prefix
+
+Unique source and output paths are created from the test.blobstore.path argument to prevent issues during parallel test execution.
+
+Blobstore source tables (tables created initially used to populate output tables) can be created on the path ${hiveconf:test.blobstore.sources} and should be updated in ./src/test/data/scripts/blobstore_test_init.q.
+
+Blobstore output tables can be created on the path ${hiveconf:test.blobstore.output} and should be created and deleted between tests (see ./src/test/queries/clientpositive/insert_into.q)
\ No newline at end of file
diff --git itests/hive-blobstore/pom.xml itests/hive-blobstore/pom.xml
new file mode 100644
index 0000000..4a2f318
--- /dev/null
+++ itests/hive-blobstore/pom.xml
@@ -0,0 +1,357 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.hive
+ hive-it
+ 2.2.0-SNAPSHOT
+ ../pom.xml
+
+
+ hive-blobstore
+ jar
+ Hive Integration - Blobstore Tests
+
+
+ ../..
+
+
+
+ false
+
+ false
+ ${hadoop.version}
+ -mkdir -p
+
+
+
+
+ tests-off
+
+
+ src/test/resources/blobstore-conf.xml
+
+
+
+ true
+
+
+
+ tests-on
+
+
+ src/test/resources/blobstore-conf.xml
+
+
+
+ false
+
+
+
+
+
+
+
+ org.apache.hive
+ hive-ant
+ ${project.version}
+ test
+
+
+ org.apache.hive
+ hive-common
+ ${project.version}
+ test
+
+
+ org.apache.hive
+ hive-contrib
+ ${project.version}
+ test
+
+
+ org.apache.hive
+ hive-metastore
+ ${project.version}
+ test
+
+
+ org.apache.hive
+ hive-metastore
+ ${project.version}
+ tests
+ test
+
+
+ org.apache.hive
+ hive-it-unit
+ ${project.version}
+ tests
+ test
+
+
+ org.apache.hive
+ hive-serde
+ ${project.version}
+ test
+
+
+ org.apache.hive
+ hive-exec
+ ${project.version}
+ test
+
+
+
+ org.apache.hadoop
+ hadoop-common
+ ${hadoop.version}
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ org.apache.hadoop
+ hadoop-common
+ ${hadoop.version}
+ tests
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ org.apache.hadoop
+ hadoop-mapreduce-client-jobclient
+ ${hadoop.version}
+ tests
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ org.apache.hadoop
+ hadoop-mapreduce-client-hs
+ ${hadoop.version}
+ test
+
+
+ org.apache.hadoop
+ hadoop-mapreduce-client-core
+ ${hadoop.version}
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ org.apache.tez
+ tez-tests
+ ${tez.version}
+ test-jar
+
+
+ org.apache.tez
+ tez-api
+ ${tez.version}
+ test
+
+
+ org.apache.tez
+ tez-runtime-library
+ ${tez.version}
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ org.apache.tez
+ tez-mapreduce
+ ${tez.version}
+ test
+
+
+ org.apache.tez
+ tez-dag
+ ${tez.version}
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+ org.apache.hadoop
+ hadoop-aws
+ ${hadoop.version}
+ compile
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ commmons-logging
+ commons-logging
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ ${jackson.new.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson.new.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.new.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ blobstore_src
+ ${test.blobstore.path}
+
+
+
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ 1.0-alpha-2
+
+
+ initialize
+
+ read-project-properties
+
+
+
+ ${basedir}/../src/test/resources/testconfiguration.properties
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ generate-tests-sources
+ generate-test-sources
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ ${maven.build-helper.plugin.version}
+
+
+ add-test-sources
+ generate-test-sources
+
+ add-test-source
+
+
+
+ target/generated-test-sources/java
+
+
+
+
+
+
+
+
+
diff --git itests/hive-blobstore/src/test/data/scripts/blobstore_test_cleanup.q itests/hive-blobstore/src/test/data/scripts/blobstore_test_cleanup.q
new file mode 100644
index 0000000..02329ab
--- /dev/null
+++ itests/hive-blobstore/src/test/data/scripts/blobstore_test_cleanup.q
@@ -0,0 +1 @@
+DROP TABLE blobstore_src purge;
diff --git itests/hive-blobstore/src/test/data/scripts/blobstore_test_init.q itests/hive-blobstore/src/test/data/scripts/blobstore_test_init.q
new file mode 100644
index 0000000..2036bae
--- /dev/null
+++ itests/hive-blobstore/src/test/data/scripts/blobstore_test_init.q
@@ -0,0 +1,14 @@
+dfs -mkdir -p ${hiveconf:test.blobstore.sources};
+set hive.stats.dbclass=fs;
+--
+-- Table blobstore_src
+--
+DROP TABLE IF EXISTS blobstore_src;
+CREATE TABLE blobstore_src (key STRING COMMENT 'default', value STRING COMMENT 'default') STORED AS TEXTFILE
+LOCATION '${hiveconf:test.blobstore.sources}/blobstore_src';
+LOAD DATA LOCAL INPATH "${hiveconf:test.data.dir}/kv1.txt" INTO TABLE blobstore_src;
+ANALYZE TABLE blobstore_src COMPUTE STATISTICS;
+ANALYZE TABLE blobstore_src COMPUTE STATISTICS FOR COLUMNS key,value;
+
+reset;
+set hive.stats.dbclass=fs;
diff --git itests/hive-blobstore/src/test/java/org/apache/hadoop/hive/cli/TestBlobstoreCliDriver.java itests/hive-blobstore/src/test/java/org/apache/hadoop/hive/cli/TestBlobstoreCliDriver.java
new file mode 100644
index 0000000..d54198f
--- /dev/null
+++ itests/hive-blobstore/src/test/java/org/apache/hadoop/hive/cli/TestBlobstoreCliDriver.java
@@ -0,0 +1,45 @@
+package org.apache.hadoop.hive.cli;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.hadoop.hive.cli.control.CliAdapter;
+import org.apache.hadoop.hive.cli.control.CliConfigs;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class TestBlobstoreCliDriver {
+
+ static CliAdapter adapter = new CliConfigs.BlobstoreCliConfig().getCliAdapter();
+
+ @Parameters(name = "{0}")
+ public static List