Example #1
0
 def override_to_data(self, alias, input_data):
     """
     Override a statement so that the alias results in having the
     specified set of data
     """
     schema = self.schemaFor(alias)
     destination = mktemp()
     cluster = Cluster(self.pig.getPigContext())
     cluster.copyContentFromLocalFile(input_data, destination, True)
     self.override(alias, "%s = LOAD '%s' AS %s;" % (alias, destination, schema))
Example #2
0
 def override_to_data(self, alias, input_data):
     """
     Override a statement so that the alias results in having the
     specified set of data
     """
     schema = self.schemaFor(alias)
     destination = mktemp()
     cluster = Cluster(self.pig.getPigContext())
     cluster.copyContentFromLocalFile(input_data, destination, True)
     self.override(alias,
                   "%s = LOAD '%s' AS %s;" % (alias, destination, schema))
Example #3
0
    def testStore(self):
        from tempfile import mktemp
        tempdir = mktemp()
        outfile = tempdir + '/top_3_queries'
        args = [
            "n=3",
            "reducers=1",
            "input=" + self.INPUT_FILE,
            "output=" + outfile,
        ]
        proxy = PigProxy.from_file(self.PIG_SCRIPT, args)

        # By default all STORE and DUMP commands are removed
        proxy.unoverride("STORE")
        proxy.run_script()
        cluster = Cluster(proxy.pig.getPigContext())
        self.assert_(cluster.delete(Path(outfile)))
Example #4
0
    def testStore(self):
        from tempfile import mktemp
        tempdir = mktemp()
        outfile = tempdir + '/top_3_queries'
        args = [
            "n=3",
            "reducers=1",
            "input=" + self.INPUT_FILE,
            "output=" + outfile,
            ]
        proxy = PigProxy.from_file(self.PIG_SCRIPT, args)

        # By default all STORE and DUMP commands are removed
        proxy.unoverride("STORE")
        proxy.run_script()
        cluster = Cluster(proxy.pig.getPigContext())
        self.assert_(cluster.delete(Path(outfile)))