예제 #1
0
    def check(self, query, name, **kwargs):
        gname = "grappa_{name}".format(name=name)

        if kwargs.get('join_type', None) == 'symmetric_hash':
            kwargs['join_type'] = grappalang.GrappaSymmetricHashJoin
        elif kwargs.get('join_type', None) == 'shuffle_hash':
            kwargs['join_type'] = grappalang.GrappaShuffleHashJoin
            # FIXME: see issue #348; always skipping shuffle tests because it got broken
            raise SkipTest()

        kwargs['target_alg'] = GrappaAlgebra()

        plan = self.get_physical_plan(query, **kwargs)
        physical_dot = viz.operator_to_dot(plan)

        with open(os.path.join("c_test_environment",
                               "{gname}.physical.dot".format(gname=gname)), 'w') as dwf:
            dwf.write(physical_dot)

        # generate code in the target language
        code = compile(plan)

        fname = os.path.join("c_test_environment", "{gname}.cpp".format(gname=gname))
        if os.path.exists(fname):
            os.remove(fname)
        with open(fname, 'w') as f:
            f.write(code)

        raise_skip_test(query)

        with Chdir("c_test_environment") as d:
            checkquery(name, GrappalangRunner())
예제 #2
0
    def check(self, query, name, join_type=None, emit_print='console', **kwargs):
        gname = "grappa_{name}".format(name=name)

        plan = self._get_grappa_physical_plan(query, join_type, emit_print, **kwargs)

        physical_dot = viz.operator_to_dot(plan)

        with open(os.path.join("c_test_environment",
                               "{gname}.physical.dot".format(gname=gname)), 'w') as dwf:
            dwf.write(physical_dot)

        # generate code in the target language
        # test_mode=True turns on extra checks like assign-once instance
        #    variables for operators
        code = compile(plan, test_mode=True, **kwargs)

        fname = os.path.join("c_test_environment", "{gname}.cpp".format(gname=gname))
        if os.path.exists(fname):
            os.remove(fname)
        with open(fname, 'w') as f:
            f.write(code)

        #raise Exception()

        raise_skip_test(query)

        with Chdir("c_test_environment") as d:
            if emit_print == 'file':
                checkstore(name, GrappalangRunner(binary_input=False))
            else:
                checkquery(name, GrappalangRunner(binary_input=False))
예제 #3
0
    def check(self, query, name, **kwargs):
        with Chdir("c_test_environment") as d:
            kwargs['target_alg'] = CCAlgebra()
            plan = self.get_physical_plan(query, **kwargs)
            physical_dot = viz.operator_to_dot(plan)
            with open("%s.physical.dot"%(name), 'w') as dwf:
                dwf.write(physical_dot)

            # generate code in the target language
            code = compile(plan)

            fname = "{name}.cpp".format(name=name)
            if os.path.exists(fname):
                os.remove(fname)
            with open(fname, 'w') as f:
                f.write(code)

            checkquery(name, ClangRunner())
예제 #4
0
    def check(self, query, name, **kwargs):
        kwargs['target_alg'] = CCAlgebra()
        plan = self.get_physical_plan(query, **kwargs)
        physical_dot = viz.operator_to_dot(plan)
        with open(
                os.path.join("c_test_environment", "%s.physical.dot" % (name)),
                'w') as dwf:
            dwf.write(physical_dot)

        # generate code in the target language
        code = compile(plan)

        fname = os.path.join("c_test_environment",
                             "{name}.cpp".format(name=name))
        if os.path.exists(fname):
            os.remove(fname)
        with open(fname, 'w') as f:
            f.write(code)

        with Chdir("c_test_environment") as d:
            checkquery(name, ClangRunner())
예제 #5
0
 def check(self, query, name):
     with Chdir("c_test_environment") as d:
         os.remove("%s.cpp" % name) if os.path.exists("%s.cpp" % name) else None
         emitCode(query, name, clang.CCAlgebra)
         checkquery(name, ClangRunner())
예제 #6
0
 def check(self, query, name):
     with Chdir("c_test_environment") as d:
         emitCode(query, 'grappa_%s' % name, GrappaAlgebra)
         # TODO actually be able to check the query
         raise SkipTest(query)
         checkquery(name, GrappalangRunner(binary_input=False))
예제 #7
0
 def check(self, query, name):
     chdir = Chdir("c_test_environment")
     emitCode(query, name, CCAlgebra)
     checkquery(name)
예제 #8
0
 def check(self, query, name):
     with Chdir("c_test_environment") as d:
         os.remove("%s.cpp" % name) if os.path.exists("%s.cpp" %
                                                      name) else None
         emitCode(query, name, clang.CCAlgebra)
         checkquery(name, ClangRunner())
예제 #9
0
 def check(self, query, name):
     with Chdir("c_test_environment") as d:
         emitCode(query, 'grappa_%s' % name, GrappaAlgebra)
         # TODO actually be able to check the query
         raise SkipTest(query)
         checkquery(name, GrappalangRunner(binary_input=False))