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

    https://github.com/apache/incubator-hawq/pull/828#discussion_r73454355
  
    --- Diff: src/test/feature/lib/hdfs_config.cpp ---
    @@ -0,0 +1,293 @@
    +#include <fstream>
    +#include <string>
    +#include <vector>
    +#include <unordered_set>
    +
    +#include "hdfs_config.h"
    +#include "command.h"
    +#include "psql.h"
    +#include "xml_parser.h"
    +#include "string_util.h"
    +
    +using std::string;
    +
    +namespace hawq {
    +namespace test {
    +
    +string HdfsConfig::getHdfsUser() {
    +  string cmd = "ps aux|grep hdfs.server|grep -v grep";
    +  Command c(cmd);
    +  string result = c.run().getResultOutput();
    +  auto lines = hawq::test::split(result, '\n');
    +  if (lines.size() >= 1) {
    +    return hawq::test::trim(hawq::test::split(lines[lines.size()-1], ' 
')[0]);
    +  } 
    +  return "hdfs";
    +}
    +
    +bool HdfsConfig::LoadFromHawqConfigFile() {
    +  const char *env = getenv("GPHOME");
    +  string confPath = env ? env : "";
    +  if (confPath != "") {
    +    confPath.append("/etc/hdfs-client.xml");
    +  } else {
    +    return false;
    +  }
    +
    +  hawqxmlconf.reset(new XmlConfig(confPath));
    +  hawqxmlconf->parse();
    --- End diff --
    
    Your should handle parse fail condition.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to