Repository: incubator-hawq
Updated Branches:
  refs/heads/master ee79ec2fc -> 120892679


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/lib/psql.h
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/psql.h b/src/test/feature/lib/psql.h
index 7fe94c1..215a43b 100644
--- a/src/test/feature/lib/psql.h
+++ b/src/test/feature/lib/psql.h
@@ -69,7 +69,7 @@ class PSQL {
   virtual ~PSQL(){};
 
   PSQL& runSQLCommand(const std::string& sql_cmd);
-  PSQL& runSQLFile(const std::string& sql_file);
+  PSQL& runSQLFile(const std::string& sql_file, bool printTupleOnly = false);
   const PSQLQueryResult& getQueryResult(const std::string& sql);
 
   PSQL& setHost(const std::string& host);
@@ -96,7 +96,7 @@ class PSQL {
 
   const std::string _getPSQLBaseCommand() const;
   const std::string _getPSQLQueryCommand(const std::string& query) const;
-  const std::string _getPSQLFileCommand(const std::string& file) const;
+  const std::string _getPSQLFileCommand(const std::string& file, bool 
printTupleOnly = false) const;
 
   std::string _dbname;
   std::string _host;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/lib/sql_util.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/sql_util.cpp 
b/src/test/feature/lib/sql_util.cpp
index a19abea..b52c4f0 100644
--- a/src/test/feature/lib/sql_util.cpp
+++ b/src/test/feature/lib/sql_util.cpp
@@ -135,7 +135,9 @@ void SQLUtility::query(const string &sql, const string 
&expectStr) {
 
 void SQLUtility::execSQLFile(const string &sqlFile,
                              const string &ansFile,
-                             const string &initFile) {
+                             const string &initFile,
+                                                        bool 
usingDefaultSchema,
+                                                        bool printTupleOnly) {
   FilePath fp;
 
   // do precheck for sqlFile & ansFile
@@ -152,12 +154,12 @@ void SQLUtility::execSQLFile(const string &sqlFile,
     ASSERT_TRUE(false) << ansFileAbsPath << " is invalid";
 
   // generate new sql file with set search_path added at the begining
-  const string newSqlFile = generateSQLFile(sqlFile);
+  const string newSqlFile = generateSQLFile(sqlFile, usingDefaultSchema);
 
   // outFile is located in the same folder with ansFile
   string outFileAbsPath = fp.path + "/" + fp.fileBaseName + ".out";
   conn->setOutputFile(outFileAbsPath);
-  EXPECT_EQ(0, conn->runSQLFile(newSqlFile).getLastStatus());
+  EXPECT_EQ(0, conn->runSQLFile(newSqlFile, printTupleOnly).getLastStatus());
   conn->resetOutput();
 
   // initFile if any
@@ -197,19 +199,18 @@ bool SQLUtility::execSQLFile(const string &sqlFile) {
   FilePath fp = splitFilePath(sqlFile);
   if (fp.fileBaseName.empty())
     return false;
-
   // outFile is located in the same folder with ansFile
   string outFileAbsPath = "/tmp/" + fp.fileBaseName + ".out";
 
   // generate new sql file with set search_path added at the begining
-  const string newSqlFile = generateSQLFile(sqlFile);
+  const string newSqlFile = generateSQLFile(sqlFile, false);
 
   // run sql file and store its result in output file
   conn->setOutputFile(outFileAbsPath);
   return conn->runSQLFile(newSqlFile).getLastStatus() == 0 ? true : false;
 }
 
-const string SQLUtility::generateSQLFile(const string &sqlFile) {
+const string SQLUtility::generateSQLFile(const string &sqlFile, bool 
usingDefaultSchema) {
   const string originSqlFile = testRootPath + "/" + sqlFile;
   const string newSqlFile = "/tmp/" + string(test_info->test_case_name()) + 
"_" + test_info->name() + ".sql";
   std::fstream in;
@@ -223,7 +224,9 @@ const string SQLUtility::generateSQLFile(const string 
&sqlFile) {
     EXPECT_TRUE(false) << "Error opening file " << newSqlFile;
   }
   out << "-- start_ignore" << std::endl;
-  out << "SET SEARCH_PATH=" + schemaName + ";" << std::endl;
+  if (!usingDefaultSchema) {
+         out << "SET SEARCH_PATH=" + schemaName + ";" << std::endl;
+  }
   if (sql_util_mode ==  MODE_DATABASE) {
     out << "\\c " << databaseName << std::endl;
   }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/lib/sql_util.h
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/sql_util.h b/src/test/feature/lib/sql_util.h
index 03544a0..3bdce10 100644
--- a/src/test/feature/lib/sql_util.h
+++ b/src/test/feature/lib/sql_util.h
@@ -31,6 +31,7 @@
 #define HAWQ_USER (getenv("PGUSER") ? getenv("PGUSER") : "")
 #define HAWQ_PASSWORD (getenv("PGPASSWORD") ? getenv("PGPASSWORD") : "")
 #define HAWQ_DEFAULT_SCHEMA ("public")
+#define RANGER_HOST (getenv("RANGERHOST") ? getenv("RANGERHOST") : "localhost")
 
 namespace hawq {
 namespace test {
@@ -88,7 +89,9 @@ class SQLUtility {
   // @param ansFile The given ansFile which is relative path to test root dir
   // @param initFile The given initFile (used by gpdiff.pl) which is relative 
path to test root dir
   // @return void
-  void execSQLFile(const std::string &sqlFile, const std::string &ansFile, 
const std::string &initFile = "");
+  void execSQLFile(const std::string &sqlFile, const std::string &ansFile,
+                 const std::string &initFile = "", bool usingDefaultSchema = 
false,
+                 bool printTupleOnly = false);
 
   // Execute sql file and check its return status
   // @param sqlFile The given sqlFile which is relative path to test root dir
@@ -125,7 +128,7 @@ class SQLUtility {
 
  private:
   std::unique_ptr<hawq::test::PSQL> getConnection();
-  const std::string generateSQLFile(const std::string &sqlFile);
+  const std::string generateSQLFile(const std::string &sqlFile, bool 
usingDefaultSchema);
   FilePath splitFilePath(const std::string &filePath) const;
   void exec(const std::string &sql);
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/sanity_tests.txt
----------------------------------------------------------------------
diff --git a/src/test/feature/sanity_tests.txt 
b/src/test/feature/sanity_tests.txt
index 93f0024..1c58281 100644
--- a/src/test/feature/sanity_tests.txt
+++ b/src/test/feature/sanity_tests.txt
@@ -3,4 +3,4 @@
 #you can have several PARALLEL or SRRIAL
 
 
PARALLEL=TestErrorTable.*:TestPreparedStatement.*:TestUDF.*:TestAOSnappy.*:TestAlterOwner.*:TestAlterTable.*:TestCreateTable.*:TestGuc.*:TestType.*:TestDatabase.*:TestParquet.*:TestPartition.*:TestSubplan.*:TestAggregate.*:TestCreateTypeComposite.*:TestGpDistRandom.*:TestInformationSchema.*:TestQueryInsert.*:TestQueryNestedCaseNull.*:TestQueryPolymorphism.*:TestQueryPortal.*:TestQueryPrepare.*:TestQuerySequence.*:TestCommonLib.*:TestToast.*:TestTransaction.*:TestCommand.*:TestCopy.*:TestHawqRegister.TestPartitionTableMultilevel:TestHawqRegister.TestUsage1ExpectSuccessDifferentSchema:TestHawqRegister.TestUsage1ExpectSuccess:TestHawqRegister.TestUsage1SingleHawqFile:TestHawqRegister.TestUsage1SingleHiveFile:TestHawqRegister.TestDataTypes:TestHawqRegister.TestUsage1EofSuccess:TestHawqRegister.TestUsage2Case1Expected:TestHawqRegister.TestUsage2Case2Expected
-SERIAL=TestExternalOid.TestExternalOidAll:TestExternalTable.TestExternalTableAll:TestTemp.BasicTest:TestRowTypes.*
+SERIAL=TestHawqRanger.BasicTest:TestExternalOid.TestExternalOidAll:TestExternalTable.TestExternalTableAll:TestTemp.BasicTest:TestRowTypes.*

Reply via email to