[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354560#comment-15354560
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user paul-guo- commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/758#discussion_r68886608
  
--- Diff: src/test/feature/lib/sql_util.cpp ---
@@ -108,8 +111,24 @@ void SQLUtility::execSQLFile(const string ,
   conn->setOutputFile(outFileAbsPath);
   EXPECT_EQ(0, conn->runSQLFile(newSqlFile).getLastStatus());
   conn->resetOutput();
-  EXPECT_FALSE(conn->checkDiff(ansFileAbsPath, outFileAbsPath, true));
-  if (conn->checkDiff(ansFileAbsPath, outFileAbsPath, true) == false) {
+
+  // initFile if any
+  string initFileAbsPath;
+  if (!initFile.empty()) {
+initFileAbsPath = testRootPath + "/" + initFile;
+if (!std::ifstream(initFileAbsPath))
+  ASSERT_TRUE(false) << initFileAbsPath << " doesn't exist";
+fp = splitFilePath(initFileAbsPath);
+// double check to avoid empty fileBaseName
+if (fp.fileBaseName.empty())
+  ASSERT_TRUE(false) << initFileAbsPath << " is invalid";
+  } else {
+initFileAbsPath = "";
+  }
+
+  bool is_sql_ans_diff = conn->checkDiff(ansFileAbsPath, outFileAbsPath, 
true, initFileAbsPath);
+  EXPECT_FALSE(is_sql_ans_diff);
+  if (is_sql_ans_diff == false) {
--- End diff --

I think we can remove the else part, right?

 } else {
EXPECT_FALSE(true);
  }


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354456#comment-15354456
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user paul-guo- commented on the issue:

https://github.com/apache/incubator-hawq/pull/758
  
Merged before xunzhang commented.


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354457#comment-15354457
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user paul-guo- closed the pull request at:

https://github.com/apache/incubator-hawq/pull/758


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354437#comment-15354437
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user xunzhang commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/758#discussion_r68878643
  
--- Diff: src/test/feature/lib/sql_util.cpp ---
@@ -108,8 +111,24 @@ void SQLUtility::execSQLFile(const string ,
   conn->setOutputFile(outFileAbsPath);
   EXPECT_EQ(0, conn->runSQLFile(newSqlFile).getLastStatus());
   conn->resetOutput();
-  EXPECT_FALSE(conn->checkDiff(ansFileAbsPath, outFileAbsPath, true));
-  if (conn->checkDiff(ansFileAbsPath, outFileAbsPath, true) == false) {
+
+  // initFile if any
+  string initFileAbsPath;
+  if (!initFile.empty()) {
+initFileAbsPath = testRootPath + "/" + initFile;
+if (!std::ifstream(initFileAbsPath))
+  ASSERT_TRUE(false) << initFileAbsPath << " doesn't exist";
+fp = splitFilePath(initFileAbsPath);
+// double check to avoid empty fileBaseName
+if (fp.fileBaseName.empty())
+  ASSERT_TRUE(false) << initFileAbsPath << " is invalid";
+  } else {
+initFileAbsPath = "";
+  }
+
+  bool is_sql_ans_diff = conn->checkDiff(ansFileAbsPath, outFileAbsPath, 
true, initFileAbsPath);
+  EXPECT_FALSE(is_sql_ans_diff);
+  if (is_sql_ans_diff == false) {
--- End diff --

why you need to check here? You have already check it above: 
`EXPECT_FALSE(is_sql_ans_diff);`, I think the if-else clause is redundant.


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354436#comment-15354436
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user xunzhang commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/758#discussion_r68878520
  
--- Diff: src/test/feature/lib/sql_util.cpp ---
@@ -108,8 +111,24 @@ void SQLUtility::execSQLFile(const string ,
   conn->setOutputFile(outFileAbsPath);
   EXPECT_EQ(0, conn->runSQLFile(newSqlFile).getLastStatus());
   conn->resetOutput();
-  EXPECT_FALSE(conn->checkDiff(ansFileAbsPath, outFileAbsPath, true));
-  if (conn->checkDiff(ansFileAbsPath, outFileAbsPath, true) == false) {
+
+  // initFile if any
+  string initFileAbsPath;
+  if (!initFile.empty()) {
+initFileAbsPath = testRootPath + "/" + initFile;
+if (!std::ifstream(initFileAbsPath))
+  ASSERT_TRUE(false) << initFileAbsPath << " doesn't exist";
+fp = splitFilePath(initFileAbsPath);
+// double check to avoid empty fileBaseName
+if (fp.fileBaseName.empty())
+  ASSERT_TRUE(false) << initFileAbsPath << " is invalid";
+  } else {
+initFileAbsPath = "";
+  }
+
+  bool is_sql_ans_diff = conn->checkDiff(ansFileAbsPath, outFileAbsPath, 
true, initFileAbsPath);
+  EXPECT_FALSE(is_sql_ans_diff);
+  if (is_sql_ans_diff == false) {
--- End diff --

`if (!is_sql_ans_diff) {`


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354406#comment-15354406
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user xunzhang commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/758#discussion_r68876831
  
--- Diff: src/test/feature/lib/hawq_config.cpp ---
@@ -151,7 +151,7 @@ bool HawqConfig::isMultinodeMode() {
   psql.getQueryResult("select hostname from gp_segment_configuration");
   std::vector table = result.getRows();
   std::unordered_set hostnameMap;
-  for (int i = 0; i < table.size(); i++) {
+  for (unsigned int i = 0; i < table.size(); i++) {
--- End diff --

use `size_t` instead


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354216#comment-15354216
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user ztao1987 commented on the issue:

https://github.com/apache/incubator-hawq/pull/758
  
+1


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354212#comment-15354212
 ] 

ASF GitHub Bot commented on HAWQ-876:
-

Github user wengyanqing commented on the issue:

https://github.com/apache/incubator-hawq/pull/758
  
LGTM


> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HAWQ-876) Add the support for initFile option of gpdiff.pl in hawq googletest framework.

2016-06-28 Thread Paul Guo (JIRA)

[ 
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15354209#comment-15354209
 ] 

Paul Guo commented on HAWQ-876:
---

I'm requesting the feature since I'm adding AO snappy tests into hawq code and 
those tests need it.

> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> --
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
>  Issue Type: Bug
>Reporter: Paul Guo
>Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides 
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init ' which defines some directives 
> for comparison. This option is quite useful for some complex sql tests.  
> Current hawq googletest work does not use this option. We need to add this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)