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

    https://github.com/apache/incubator-hawq/pull/878#discussion_r77279326
  
    --- Diff: tools/bin/hawqregister ---
    @@ -327,50 +327,85 @@ def insert_metadata_into_database(dburl, 
databasename, tablename, seg_name, firs
         '''Insert the metadata into database'''
         try:
             query = "SET allow_system_table_mods='dml';"
    -        segno = firstsegno
    -        for eof in eofs:
    -            query += "insert into pg_aoseg.%s values(%d, %d, %d, %d);" % 
(seg_name, segno, eof, -1, -1)
    -            segno += 1
    +        query += 'insert into pg_aoseg.%s values(%d, %d, %d, %d)' % 
(seg_name, firstsegno, eofs[0], -1, -1)
    +        for k, eof in enumerate(eofs[1:]):
    +            query += ',(%d, %d, %d, %d)' % (firstsegno + k + 1, eof, -1, 
-1)
    +        query += ';'
             conn = dbconn.connect(dburl, True)
             rows = dbconn.execSQL(conn, query)
             conn.commit()
             conn.close()
         except DatabaseError, ex:
             logger.error('Failed to connect to database, this script can only 
be run when the database is up')
    -        move_files_in_hdfs(options.database, options.tablename, files, 
firstsegno, tabledir, False)
    +        move_files_in_hdfs(database, tablename, files, firstsegno, 
tabledir, False)
             sys.exit(1)
     
     
     if __name__ == '__main__':
    +
         parser = option_parser()
         options, args = parser.parse_args()
    -    if len(args) != 1 or (options.yml_config and options.filepath):
    +
    +    if len(args) != 1 or ((options.yml_config or options.force or 
options.repair) and options.filepath) or (options.force and options.repair):
             parser.print_help(sys.stderr)
             sys.exit(1)
         if local_ssh('hadoop', logger):
             logger.error('command "hadoop" is not available.')
             sys.exit(1)
     
    -    dburl = dbconn.DbURL(hostname=options.host, port=options.port, 
username=options.user, dbname=options.database)
    +    dburl = dbconn.DbURL(hostname = options.host, port = options.port, 
username = options.user, dbname = options.database)
         filepath, database, tablename = options.filepath, options.database, 
args[0]
     
    +    second_normal_mode, second_exist_mode, force_mode, repair_mode = 
False, False, False, False
         if options.yml_config: # Usage2
    -        fileformat, filepath, schema, distribution_policy, file_locations 
= option_parser_yml(options.yml_config)
    -        create_table(dburl, tablename, schema, fileformat, 
distribution_policy, file_locations)
    +        if options.force:
    +            force_mode = True
    +        elif options.repair:
    +            repair_mode = True
    +        else:
    +            second_normal_mode = True
    +        fileformat, files, sizes, schema, distribution_policy, 
file_locations, bucket_number = option_parser_yml(options.yml_config)
    +        filepath = files[0][:files[0].rfind('/')] if files else ''
    +        if distribution_policy.startswith('DISTRIBUTED BY'):
    +            if len(files) % bucket_number != 0:
    +                logger.error('Files to be registered must match the bucket 
number of hash table.')
    --- End diff --
    
    What about adding more information describing "match"?  for example, "be 
multiple times of"


---
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.
---

Reply via email to