Package shark.api

Examples of shark.api.JavaTableRDD.map()


    }

    @Test
    public void sql2rdd() {
        JavaTableRDD result = sc.sql2rdd("select val from test_java");
        JavaRDD<String> values = result.map(new Function<Row, String>() {
            @Override
            public String call(Row x) {
                return x.getString(0);
            }
        });
View Full Code Here


    public void union() {
        JavaTableRDD a = sc.sql2rdd("select * from users_java where name = \"A\"");
        JavaTableRDD b = sc.sql2rdd("select * from users_java where name = \"B\"");
        JavaTableRDD union = a.union(b);
        Assert.assertEquals(3, union.count());
        List<String> uniqueNames = union.map(new Function<Row, String>() {
            @Override
            public String call(Row row) throws Exception {
                return row.getString("name");
            }
        }).distinct().collect();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.