Github user xunzhang commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/846#discussion_r75244123 --- Diff: tools/bin/hawqregister --- @@ -40,186 +39,195 @@ EXECNAME = os.path.split(__file__)[-1] setup_tool_logging(EXECNAME,getLocalHostname(),getUserName()) -def create_opt_parser(version): +def option_parser(): parser = OptParser(option_class=OptChecker, - usage='usage: %prog [options] database_name table_name file_or_dir_path_in_hdfs', - version=version) + usage='usage: %prog [options] table_name', + version='%prog version $Revision: #1 $') parser.remove_option('-h') parser.add_option('-?', '--help', action='help') - parser.add_option('-h', '--host', help="host of the target DB") - parser.add_option('-p', '--port', help="port of the target DB", type='int', default=0) - parser.add_option('-U', '--user', help="username of the target DB") - return parser - - -def check_hadoop_command(): - hdfscmd = "hadoop" - result = local_ssh(hdfscmd); - if result != 0: - logger.error("command 'hadoop' is not available, please set environment variable $PATH to fix this") + parser.add_option('-h', '--host', help='host of the target DB') + parser.add_option('-p', '--port', help='port of the target DB', type='int', default=0) + parser.add_option('-U', '--user', help='username of the target DB') + parser.add_option('-d', '--database', default = 'postgres', dest = 'database', help='database name') + parser.add_option('-f', '--filepath', dest = 'filepath', help='file name in HDFS') + parser.add_option('-c', '--config', dest = 'yml_config', default = '', help='configuration file in YAML format') + return parser.parse_args() + + +def option_parser_yml(yml_file): + import yaml + with open(yml_file, 'r') as f: + params = yaml.load(f) + if params['FileFormat'] == 'Parquet': + offset = params['Parquet_FileLocations']['Files'][0]['path'].rfind('/') + filepath = params['DFS_URL'] + params['Parquet_FileLocations']['Files'][0]['path'][:offset] if len(params['Parquet_FileLocations']['Files']) != 1 else params['DFS_URL'] + params['Parquet_FileLocations']['Files'][0]['path'] --- End diff -- Sure.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---