コード例 #1
0
    for i in range(ntables):
        # read in number of row, num dimensions, measures, multiplicities
        nrows = int(sys.argv[ctr])
        ndims = int(sys.argv[ctr + 1])
        nmeasures = int(sys.argv[ctr + 2])
        ctr = ctr + 3
        mult = [0] * ndims
        for i in range(ndims):
            mult[i] = int(sys.argv[ctr])
            ctr = ctr + 1

        # create the first table without a foreign key column. All subsequent
        # tables will have foreign key columns referring to primary key of
        # previous table
        if first:
            createSingleTable.generate_single_table(nrows, ndims, nmeasures,
                                                    mult)
        else:
            createSingleTable.generate_single_table(
                nrows,
                ndims,
                nmeasures,
                mult,
                join=True,
                join_range=prev_nrows,
                selectivity=selectivities[i],
                ntable=i + 1)

        # update loop vars
        prev_nrows = nrows
        first = False
コード例 #2
0
    possible_distinct_values = [
        2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000
    ]
    distinct_values_probability = [1, 1, 1, 2, 2, 2, 3, 3, 3, 2, 2, 2]

    num_distinct_values = []
    for x in range(len(possible_distinct_values)):
        print x, possible_distinct_values[
            x], min_distinct_values <= possible_distinct_values[x]
        print min_distinct_values, possible_distinct_values[
            x], possible_distinct_values[x], max_distinct_values
        print(min_distinct_values <= possible_distinct_values[x]), (
            possible_distinct_values[x] <= max_distinct_values)
        if (min_distinct_values <= possible_distinct_values[x]) and (
                possible_distinct_values[x] <= max_distinct_values):
            print "here2"
            for i in range(distinct_values_probability[x]):
                num_distinct_values += [possible_distinct_values[x]]
        else:
            print "here"
            continue

    print num_distinct_values
    # select data from distict values
    mult = []
    for x in range(int(ndims)):
        mult += [random.choice(num_distinct_values)]

    createSingleTable.generate_single_table(nrows, ndims, nmeasures, mult)
コード例 #3
0
ファイル: createJoinTable.py プロジェクト: asfink/seedb
  ctr = 2
  selectivities = []
  for i in range(ntables-1):
    selectivities = selectivities + [float(sys.argv[ctr])]
    ctr = ctr + 1

  prev_nrows = None # used in join_range
  for i in range(ntables):
    # read in number of row, num dimensions, measures, multiplicities
    nrows = int(sys.argv[ctr])
    ndims = int(sys.argv[ctr+1])
    nmeasures = int(sys.argv[ctr+2])
    ctr = ctr + 3
    mult = [0] * ndims
    for i in range(ndims):
        mult[i] = int(sys.argv[ctr])
        ctr = ctr + 1

    # create the first table without a foreign key column. All subsequent 
    # tables will have foreign key columns referring to primary key of 
    # previous table
    if first:
      createSingleTable.generate_single_table(nrows, ndims, nmeasures, mult)
    else:
      createSingleTable.generate_single_table(nrows, ndims, nmeasures, mult, 
        join=True, join_range = prev_nrows, selectivity=selectivities[i], 
        ntable=i+1)

    # update loop vars
    prev_nrows = nrows
    first = False
コード例 #4
0
  ndims = int(sys.argv[2])
  nmeasures = int(sys.argv[3])
  min_distinct_values = int(sys.argv[4])
  max_distinct_values = int(sys.argv[5])

  print min_distinct_values, max_distinct_values

  possible_distinct_values = [2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000]
  distinct_values_probability = [1, 1, 1, 2, 2, 2, 3, 3, 3, 2, 2, 2]

  num_distinct_values = []
  for x in range(len(possible_distinct_values)):
    print x, possible_distinct_values[x], min_distinct_values <= possible_distinct_values[x]
    print min_distinct_values, possible_distinct_values[x], possible_distinct_values[x], max_distinct_values
    print (min_distinct_values <= possible_distinct_values[x]),  (possible_distinct_values[x] <= max_distinct_values)
    if (min_distinct_values <= possible_distinct_values[x]) and (possible_distinct_values[x] <= max_distinct_values): 
      print "here2"
      for i in range(distinct_values_probability[x]):
      	num_distinct_values += [possible_distinct_values[x]]
    else:
      print "here"
      continue

  print num_distinct_values
  # select data from distict values
  mult = []
  for x in range(int(ndims)):
  	mult += [random.choice(num_distinct_values)]

  createSingleTable.generate_single_table(nrows, ndims, nmeasures, mult)