Package org.apache.mahout.pig.encoders

Examples of org.apache.mahout.pig.encoders.EncodingSpec


import static org.junit.Assert.fail;

public class EncodingSpecTest {
    @Test
    public void testSum() throws RecognitionException, IOException {
        EncodingSpec z = parse("a+c+b");
        Assert.assertEquals("[[a], [b], [c]]", z.getVariables().toString());

        try {
            parse("a+$1+$2");
            fail("Should have failed");
        } catch (FormulaParseException e) {
            assertTrue(e.getMessage().startsWith("Syntax error"));
        }

        z = parse("a + 1");
        Assert.assertEquals("[[1], [a]]", z.getVariables().toString());
    }
View Full Code Here


        }
    }

    @Test
    public void testProduct() throws RecognitionException, IOException {
        EncodingSpec z = parse("a+c*b");
        Assert.assertEquals("[[a], [b], [b, c], [c]]", z.getVariables().toString());
        z = parse("(a+c)*(c+b+a)");
        Assert.assertEquals("[[a], [a, b], [a, c], [b], [b, c], [c]]", z.getVariables().toString());
    }
View Full Code Here

        Assert.assertEquals("[[a], [a, b], [a, c], [b], [b, c], [c]]", z.getVariables().toString());
    }

    @Test
    public void testPower() throws RecognitionException, IOException {
        EncodingSpec z = parse("(a+b+c)^2");
        Assert.assertEquals("[[a], [a, b], [a, c], [b], [b, c], [c]]", z.getVariables().toString());

        z = parse("(a+b+c)^3");
        Assert.assertEquals("[[a], [a, b], [a, b, c], [a, c], [b], [b, c], [c]]", z.getVariables().toString());

        z = parse("(a+b+c)^30");
        Assert.assertEquals("[[a], [a, b], [a, b, c], [a, c], [b], [b, c], [c]]", z.getVariables().toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.pig.encoders.EncodingSpec

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.