parameters: (opts, stats)
docstring: Load a table with data using the DistributedDataGenerator spark job
docstring_summary: Load a table with data using the DistributedDataGenerator spark job
docstring_tokens: Load a table with data using the DistributedDataGenerator spark job
function: def load_table(opts, stats):
    """ Load a table with data using the DistributedDataGenerator spark job """
    print("--------------------------------------")
    print("Loading table %s" % (opts.table_name,))
    print("--------------------------------------")
    print(timestamp())
    # Example invocation:
    #   spark-submit --class org.apache.kudu.spark.tools.DistributedDataGenerator \
    #     kudu-spark2-tools_2.11-1.8.0-SNAPSHOT.jar \
    #     --type random \
    #     --num-rows 10000000 \
    #     --num-tasks 20 \
    #     impala::default.foo_test3 m123.example.com
    CLASS_NAME = 'org.apache.kudu.spark.tools.DistributedDataGenerator'
    # TODO: Non-string columns are assumed to be 8 bytes.
    row_size_bytes = opts.num_string_columns * opts.string_field_len + \
                     (opts.columns - opts.num_string_columns) * 8
    num_rows = opts.table_data_size_mb * 1024 * 1024 / row_size_bytes
    print("INFO: Inserting %d rows of %d bytes each" % (num_rows, row_size_bytes))
    stats['row_size_bytes'] = row_size_bytes
    stats['num_rows'] = num_rows
    cmd = "%s --class %s %s --type %s --num-rows %d --num-tasks %d %s %s" % \
      (opts.spark_submit_command, CLASS_NAME, opts.kudu_spark_tools_jar,
       opts.load_policy, num_rows, opts.load_num_tasks, opts.table_prefix + opts.table_name,
       opts.master_addresses)
    run_command(opts, cmd)
function_tokens: def load_table ( opts , stats ) : print ( "--------------------------------------" ) print ( "Loading table %s" % ( opts . table_name , ) ) print ( "--------------------------------------" ) print ( timestamp ( ) ) # Example invocation: #   spark-submit --class org.apache.kudu.spark.tools.DistributedDataGenerator \ #     kudu-spark2-tools_2.11-1.8.0-SNAPSHOT.jar \ #     --type random \ #     --num-rows 10000000 \ #     --num-tasks 20 \ #     impala::default.foo_test3 m123.example.com CLASS_NAME = 'org.apache.kudu.spark.tools.DistributedDataGenerator' # TODO: Non-string columns are assumed to be 8 bytes. row_size_bytes = opts . num_string_columns * opts . string_field_len + ( opts . columns - opts . num_string_columns ) * 8 num_rows = opts . table_data_size_mb * 1024 * 1024 / row_size_bytes print ( "INFO: Inserting %d rows of %d bytes each" % ( num_rows , row_size_bytes ) ) stats [ 'row_size_bytes' ] = row_size_bytes stats [ 'num_rows' ] = num_rows cmd = "%s --class %s %s --type %s --num-rows %d --num-tasks %d %s %s" % ( opts . spark_submit_command , CLASS_NAME , opts . kudu_spark_tools_jar , opts . load_policy , num_rows , opts . load_num_tasks , opts . table_prefix + opts . table_name , opts . master_addresses ) run_command ( opts , cmd )