Package org.apache.pig.builtin

Examples of org.apache.pig.builtin.REPLACE


        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));
       
        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);


        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));
       
        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);

        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));
       
        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);

        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));

        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);

        assertEquals( ((Integer) "xyz".lastIndexOf("abc")), lastIndexOf.exec(testTuple));
    }
   
    @Test
    public void testReplace() throws IOException {
        REPLACE replace = new REPLACE();
        Tuple testTuple = Util.buildTuple("foobar", "z", "x");
        assertEquals("foobar".replace("z", "x"), replace.exec(testTuple));
       
        testTuple = Util.buildTuple("foobar", "oo", "aa");
        assertEquals("foobar".replace("oo", "aa"), replace.exec(testTuple));
    }

        assertEquals( ((Integer) "xyz".lastIndexOf("abc")), lastIndexOf.exec(testTuple));
    }
   
    @Test
    public void testReplace() throws IOException {
        REPLACE replace = new REPLACE();
        Tuple testTuple = Util.buildTuple("foobar", "z", "x");
        assertEquals("foobar".replace("z", "x"), replace.exec(testTuple));
       
        testTuple = Util.buildTuple("foobar", "oo", "aa");
        assertEquals("foobar".replace("oo", "aa"), replace.exec(testTuple));
    }

        assertEquals( ((Integer) "xyz".lastIndexOf("abc")), lastIndexOf.exec(testTuple));
    }
   
    @Test
    public void testReplace() throws IOException {
        REPLACE replace = new REPLACE();
        Tuple testTuple = Util.buildTuple("foobar", "z", "x");
        assertEquals("foobar".replace("z", "x"), replace.exec(testTuple));
       
        testTuple = Util.buildTuple("foobar", "oo", "aa");
        assertEquals("foobar".replace("oo", "aa"), replace.exec(testTuple));
    }

        assertEquals( ((Integer) "xyz".lastIndexOf("abc")), lastIndexOf.exec(testTuple));
    }
   
    @Test
    public void testReplace() throws IOException {
        REPLACE replace = new REPLACE();
        Tuple testTuple = Util.buildTuple("foobar", "z", "x");
        assertEquals("foobar".replace("z", "x"), replace.exec(testTuple));
       
        testTuple = Util.buildTuple("foobar", "oo", "aa");
        assertEquals("foobar".replace("oo", "aa"), replace.exec(testTuple));
    }

        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));

        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);

        input = TupleFactory.getInstance().newTuple(inputStr);
        expected = inputStrLower;
        output = strFunc.exec(input);
        assertTrue(output.equals(expected));

        strFunc = new REPLACE();
        l.clear();
        l.add(inputStr);
        l.add("o");
        l.add("a");
        input = TupleFactory.getInstance().newTuple(l);

TOP

Related Classes of org.apache.pig.builtin.REPLACE

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.