예제 #1
0
def hypercube_shuffle():
    """
    Only hypercube shuffle
    """
    json_query_files = [
        "q1_hc_1.json", "q1_hc_2.json", "q1_hc_3.json", "q1_hc_4.json",
        "q1_hc_5.json", "q1_hc_6.json", "q1_hc_7.json", "q1_hc_8.json"]
    for query_file_path in json_query_files:
        with open(query_file_path) as jf:
            query = json.load(jf)
            print "executing query {}".format(query_file_path)
            client.execute_json(query)
예제 #2
0
def hypercube_shuffle():
    """
    Only hypercube shuffle
    """
    json_query_files = [
        "q1_hc_1.json", "q1_hc_2.json", "q1_hc_3.json", "q1_hc_4.json",
        "q1_hc_5.json", "q1_hc_6.json", "q1_hc_7.json", "q1_hc_8.json"
    ]
    for query_file_path in json_query_files:
        with open(query_file_path) as jf:
            query = json.load(jf)
            print "executing query {}".format(query_file_path)
            client.execute_json(query)
예제 #3
0
def execute_original_query():
    with open("q8_lfj_local.json") as f:
        json_query = json.load(f)
    new_order = (0, 1, 2, 3, 4, 5)
    print "executing {}".format(new_order)
    new_query, a, b = attrorder.change_order(json_query, new_order)
    # new_query["profilingMode"] = 'QUERY'
    result, status = client.execute_json(new_query)
예제 #4
0
def execute_original_query():
    with open("q8_lfj_local.json") as f:
        json_query = json.load(f)
    new_order = (0, 1, 2, 3, 4, 5)
    print "executing {}".format(new_order)
    new_query, a, b = attrorder.change_order(json_query, new_order)
    # new_query["profilingMode"] = 'QUERY'
    result, status = client.execute_json(new_query)
예제 #5
0
def exp_q8():
    with open("q8_lfj_local.json") as f:
        json_query = json.load(f)
    for order in sampled_orders[18:]:
        # print "executing {}".format(order)
        new_query, a, b = attrorder.change_order(json_query, order)
        result, status = client.execute_json(new_query)
        if result == 'success':
            output = (order, attrorder.q8(order), float(status["elapsedNanos"]) / client.NANO_IN_ONE_SEC)
            print ",".join([str(i) for i in output])
        else:
            raise ValueError("Error when executing {}".format(order))
예제 #6
0
def exp_q8():
    with open("q8_lfj_local.json") as f:
        json_query = json.load(f)
    for order in sampled_orders[18:]:
        # print "executing {}".format(order)
        new_query, a, b = attrorder.change_order(json_query, order)
        result, status = client.execute_json(new_query)
        if result == 'success':
            output = (order, attrorder.q8(order),
                      float(status["elapsedNanos"]) / client.NANO_IN_ONE_SEC)
            print ",".join([str(i) for i in output])
        else:
            raise ValueError("Error when executing {}".format(order))
예제 #7
0
def random_order_lfj(query_file, log_file_name, orders):
    with open(query_file) as f:
        json_query = json.load(f)

    with open(log_file_name, "wb") as f:
        csvwriter = csv.writer(f)
        csvwriter.writerow(["query_id", "order", "time", "success or fail"])
        for order in orders:
            json_query, a, b = attrorder.change_order(json_query, order)
            print "execute leapfrog join with order {}".format(order)
            result, status = client.execute_json(json_query)
            # log experiment result
            if result == 'success':
                print "success"
                time = float(status["elapsedNanos"]) / client.NANO_IN_ONE_SEC
                csvwriter.writerow([
                    status["queryId"], str(order), time, "success"])
            else:
                print "error"
                csvwriter.writerow(["N.A.", str(order), "N.A.", "fail"])
예제 #8
0
def random_order_lfj(query_file, log_file_name, orders):
    with open(query_file) as f:
        json_query = json.load(f)

    with open(log_file_name, "wb") as f:
        csvwriter = csv.writer(f)
        csvwriter.writerow(["query_id", "order", "time", "success or fail"])
        for order in orders:
            json_query, a, b = attrorder.change_order(json_query, order)
            print "execute leapfrog join with order {}".format(order)
            result, status = client.execute_json(json_query)
            # log experiment result
            if result == 'success':
                print "success"
                time = float(status["elapsedNanos"]) / client.NANO_IN_ONE_SEC
                csvwriter.writerow(
                    [status["queryId"],
                     str(order), time, "success"])
            else:
                print "error"
                csvwriter.writerow(["N.A.", str(order), "N.A.", "fail"])
예제 #9
0
def scl_exp(log_file_name):
    queries = [
        "triangle_worker_32.json",
        "triangle_worker_16.json",
        "triangle_worker_2.json",
        "triangle_worker_4.json",
        "triangle_worker_8.json"
    ]

    with open(log_file_name, "wb") as f:
        csvwriter = csv.writer(f)
        csvwriter.writerow(["query_id", "time", "success or fail"])
        for query in queries:
            with open(query) as qf:
                json_query = json.load(qf)
            if query == "triangle_worker_2.json":
                workers = [1, 2]
            elif query == "triangle_worker_4.json":
                workers = list(range(1, 5))
            elif query == "triangle_worker_8.json":
                workers = list(range(1, 9))
            elif query == "triangle_worker_16.json":
                workers = list(range(1, 17))
            elif query == "triangle_worker_32.json":
                workers = list(range(1, 33))
            for fragment in json_query["plan"]["fragments"]:
                fragment["workers"] = workers
            result, status = client.execute_json(json_query)
            # log experiment result
            if result == 'success':
                print "success"
                time = float(status["elapsedNanos"]) / client.NANO_IN_ONE_SEC
                csvwriter.writerow([
                    status["queryId"], time, "success"])
            else:
                print "error"
                csvwriter.writerow(["N.A.", "N.A.", "fail"])