Package cascading.tap

Examples of cascading.tap.Tap



    @Test
    public void testUpdate() throws Exception {
        // local file-system source
        Tap in = sourceTap();
        Tap out = new EsTap("json-cascading-local/createwithid", new Fields("line"));
        Properties props = new TestSettings().getProperties();
        props.put(ConfigurationOptions.ES_MAPPING_ID, "number");
        props.put(ConfigurationOptions.ES_INPUT_JSON, "yes");

        Pipe pipe = new Pipe("copy");
View Full Code Here


        properties.put(ConfigurationOptions.ES_UPDATE_RETRY_ON_CONFLICT, "3");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter = 3");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_LANG, "groovy");
        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/createwithid", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter = param1; anothercounter = param2");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_LANG, "groovy");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_PARAMS, " param1:<1>,   param2:number ");
        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/createwithid", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter = param1; anothercounter = param2");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_LANG, "groovy");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_PARAMS_JSON, "{ \"param1\":1, \"param2\":2}");
        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/createwithid", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        Properties properties = new TestSettings().getProperties();
        properties.put(ConfigurationOptions.ES_WRITE_OPERATION, "upsert");
        properties.put(ConfigurationOptions.ES_MAPPING_ID, "number");
        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");

        Tap in = sourceTap();
        Tap out = new EsTap("json-cascading-local/upsert", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        properties.put(ConfigurationOptions.ES_WRITE_OPERATION, "upsert");
        properties.put(ConfigurationOptions.ES_MAPPING_ID, "number");
        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter = 1");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/upsert-script", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter += param1; anothercounter += param2");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_LANG, "groovy");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_PARAMS, " param1:<1>,   param2:number ");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/upsert-param-script", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

        properties.put(ConfigurationOptions.ES_INPUT_JSON, "yes");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT, "counter += param1; anothercounter += param2");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_LANG, "groovy");
        properties.put(ConfigurationOptions.ES_UPDATE_SCRIPT_PARAMS_JSON, "{ \"param1\":1, \"param2\":2}");

        Tap in = sourceTap();
        // use an existing id to allow the update to succeed
        Tap out = new EsTap("json-cascading-local/upsert-script-json-script", new Fields("line"));

        Pipe pipe = new Pipe("copy");
        build(properties, in, out, pipe);
    }
View Full Code Here

    }


    @Test
    public void testReadFromES() throws Exception {
        Tap in = new EsTap(indexPrefix + "cascading-hadoop/artists");
        Pipe pipe = new Pipe("copy");
        pipe = new Each(pipe, new FilterNotNull());
        pipe = new Each(pipe, AssertionLevel.STRICT, new AssertSizeLessThan(5));
        // can't select when using unknown
        //pipe = new Each(pipe, new Fields("name"), AssertionLevel.STRICT, new AssertNotNull());
        pipe = new GroupBy(pipe);
        pipe = new Every(pipe, new Count());

        // print out
        Tap out = new HadoopPrintStreamTap(Stream.NULL);
        build(cfg(), in, out, pipe);
    }
View Full Code Here

        RestUtils.refresh(indexPrefix + "cascading-hadoop");

        Properties cfg = cfg();
        cfg.setProperty("es.mapping.names", "nested:data.map.key");

        Tap in = new EsTap(indexPrefix + "cascading-hadoop/nestedmap", new Fields("nested"));
        Pipe pipe = new Pipe("copy");
        pipe = new Each(pipe, new FilterNotNull());
        pipe = new Each(pipe, AssertionLevel.STRICT, new AssertSizeLessThan(2));

        // print out
        Tap out = new HadoopPrintStreamTap(Stream.NULL);
        build(cfg, in, out, pipe);
    }
View Full Code Here

TOP

Related Classes of cascading.tap.Tap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.