本文整理汇总了Java中org.apache.pig.impl.logicalLayer.FrontendException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java FrontendException.getMessage方法的具体用法?Java FrontendException.getMessage怎么用?Java FrontendException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.impl.logicalLayer.FrontendException
的用法示例。
在下文中一共展示了FrontendException.getMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tesNegative9
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test // PIG-1956, 1957
public void tesNegative9() throws IOException {
pig.registerQuery("a = load 'temp' as (a0:int, a1:int);\n");
pig.registerQuery("b = group a by a0;\n");
try {
pig.registerQuery("c = foreach b { " +
" c1 = foreach a { " +
" c11 = filter a by a1 > 0; " +
" generate c11; " +
" } " +
" generate c1; " +
" }\n");
} catch (FrontendException ex) {
String msg = ex.getMessage();
Assert.assertTrue( msg.contains( "line 5, column 32" ) );
Assert.assertTrue( msg.contains( "mismatched input '{' expecting GENERATE"));
return;
}
Assert.fail( "Testcase should fail" );
}
示例2: tesNegative13
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test // PIG-1921
public void tesNegative13() throws IOException {
String query = "A = load 'x' as (u:int, v);\n" +
"B = load 'y';\n" +
"C = join A by u, B by w;";
try {
pig.registerQuery( query );
} catch(FrontendException ex) {
String msg = ex.getMessage();
System.out.println( msg );
Assert.assertTrue( !msg.contains( "null") );
Assert.assertTrue( msg.contains( "Projected field [w] does not exist.") );
return;
}
Assert.fail( "Testcase should fail" );
}
示例3: testBagConstantAccessFailure
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void testBagConstantAccessFailure() throws IOException, ExecException {
File input = Util.createInputFile("tmp", "",
new String[] {"sampledata\tnot_used"});
boolean exceptionOccured = false;
pigServer.setValidateEachStatement(true);
try {
pigServer.registerQuery("a = load '"
+ Util.generateURI(Util.encodeEscape(input.toString()), pigServer.getPigContext()) + "';");
pigServer.registerQuery("b = foreach a generate {(16, 4.0e-2, 'hello')} as mybag:{t:(i: int, d: double, c: chararray)};");
pigServer.registerQuery("c = foreach b generate mybag.t;");
pigServer.explain("c", System.out);
} catch(FrontendException e) {
exceptionOccured = true;
String msg = e.getMessage();
Util.checkStrContainsSubStr(msg, "Cannot find field t in i:int,d:double,c:chararray");
}
assertTrue(exceptionOccured);
}
示例4: expandImport
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
private boolean expandImport(Tree ast) throws ParserException {
List<CommonTree> nodes = new ArrayList<CommonTree>();
traverseImport(ast, nodes);
if (nodes.isEmpty())
return false;
// Validate if imports are enabled/disabled
final BlackAndWhitelistFilter filter = new BlackAndWhitelistFilter(
this.pigContext);
try {
filter.validate(PigCommandFilter.Command.IMPORT);
} catch (FrontendException e) {
throw new ParserException(e.getMessage());
}
for (CommonTree t : nodes) {
macroImport(t);
}
return true;
}
示例5: testBagConstantAccessFailure
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void testBagConstantAccessFailure() throws IOException, ExecException {
File input = Util.createInputFile("tmp", "",
new String[] {"sampledata\tnot_used"});
boolean exceptionOccured = false;
pigServer.setValidateEachStatement(true);
try {
pigServer.registerQuery("a = load '"
+ Util.generateURI(input.toString(), pigServer.getPigContext()) + "';");
pigServer.registerQuery("b = foreach a generate {(16, 4.0e-2, 'hello')} as mybag:{t:(i: int, d: double, c: chararray)};");
pigServer.registerQuery("c = foreach b generate mybag.t;");
pigServer.explain("c", System.out);
} catch(FrontendException e) {
exceptionOccured = true;
String msg = e.getMessage();
Util.checkStrContainsSubStr(msg, "Cannot find field t in i:int,d:double,c:chararray");
}
assertTrue(exceptionOccured);
}
示例6: tesNegative11
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test // PIG-1961
public void tesNegative11() throws IOException {
String query = "A = load ^ 'x' as (name, age, gpa);\n";
try {
pig.registerQuery( query );
} catch(FrontendException ex) {
String msg = ex.getMessage();
System.out.println( msg );
Assert.assertFalse( msg.contains( "file null" ) );
Assert.assertTrue( msg.contains( "Unexpected character" ) );
return;
}
Assert.fail( "Testcase should fail" );
}
示例7: tesNegative12
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test // PIG-1961
public void tesNegative12() throws IOException {
String query = "A = loadd 'x' as (name, age, gpa);\n";
try {
pig.registerQuery( query );
} catch(FrontendException ex) {
String msg = ex.getMessage();
System.out.println( msg );
Assert.assertFalse( msg.contains( "file null" ) );
Assert.assertTrue( msg.contains( "Syntax error, unexpected symbol at or near 'A'" ) );
return;
}
Assert.fail( "Testcase should fail" );
}
示例8: defineCommand
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
void defineCommand(String alias, StreamingCommand command) {
try {
filter.validate(PigCommandFilter.Command.DEFINE);
} catch (FrontendException e) {
throw new RuntimeException(e.getMessage());
}
pigContext.registerStreamCmd( alias, command );
}
示例9: testNegative14
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test //pig-2606
public void testNegative14() throws IOException {
String query = "A = load 'x'; \n" +
"B = union A, A;";
try {
pig.registerQuery( query );
} catch(FrontendException ex) {
String msg = ex.getMessage();
System.out.println( msg );
Assert.assertTrue( msg.contains( "Pig does not accept same alias as input for") );
Assert.assertTrue( msg.contains( "UNION") );
return;
}
Assert.fail( "Testcase should fail" );
}
示例10: testNegative15
import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test //pig-2606
public void testNegative15() throws IOException {
String query = "A = load 'x' as (a0, a1); \n" +
"B = join A by a0, A by a1;";
try {
pig.registerQuery( query );
} catch(FrontendException ex) {
String msg = ex.getMessage();
System.out.println( msg );
Assert.assertTrue( msg.contains( "Pig does not accept same alias as input for") );
Assert.assertTrue( msg.contains( "JOIN") );
return;
}
Assert.fail( "Testcase should fail" );
}