本文整理汇总了Java中org.apache.pig.PigException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PigException.getMessage方法的具体用法?Java PigException.getMessage怎么用?Java PigException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.PigException
的用法示例。
在下文中一共展示了PigException.getMessage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSchemaEx
import org.apache.pig.PigException; //导入方法依赖的package包/类
private void checkSchemaEx(String query, String expectedErr) throws IOException {
PigServer pig = new PigServer(ExecType.LOCAL);
boolean foundEx = false;
try{
Util.registerMultiLineQuery(pig, query);
pig.dumpSchema("u");
}catch(FrontendException e){
PigException pigEx = LogUtils.getPigException(e);
foundEx = true;
if(!pigEx.getMessage().contains(expectedErr)){
String msg = "Expected exception message matching '"
+ expectedErr + "' but got '" + pigEx.getMessage() + "'" ;
fail(msg);
}
}
if(!foundEx)
fail("No exception thrown. Exception is expected.");
}
示例2: testByteArrayCast1
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast1() throws IOException {
// Passing (float, bytearray)
// Ambiguous matches: (float, long) , (float, double)
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x:float, y);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y);");
Iterator<Tuple> iter = pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("{float,double}, {float,long}"));
}
assertTrue(exceptionCaused);
}
示例3: testByteArrayCast5
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast5() throws IOException, ExecException {
// Passing (bytearray, int, int )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two ints cannot be unambiguously
// casted
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:int);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
Iterator<Tuple> iter = pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
}
assertTrue(exceptionCaused);
}
示例4: testByteArrayCast6
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast6() throws IOException, ExecException {
// Passing (bytearray, long, long )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two longs cannot be
// unambiguously casted
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:long);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
Iterator<Tuple> iter = pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
}
assertTrue(exceptionCaused);
}
示例5: testByteArrayCast7
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast7() throws IOException, ExecException {
// Passing (bytearray, double, double )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two doubles cannot be
// casted with a permissible cast
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:double);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
Iterator<Tuple> iter = pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Could not infer the matching function"));
}
assertTrue(exceptionCaused);
}
示例6: testByteArrayCast12
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast12() throws IOException, ExecException {
// Passing (float, bytearray, int )
// Ambiguous matches: (float, long, double) , (float, double, long)
// will cause conflict since we could cast int to
// long or double and bytearray to long or double.
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile2 + "' as (x:float, y, z:int);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
Iterator<Tuple> iter = pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double}"));
}
assertTrue(exceptionCaused);
}
示例7: test2
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void test2() throws Exception {
// Passing (int, int)
// Possible matches: (float, float) , (long, double)
// Throws Exception as ambiguous definitions found
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x:long, y:int);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF1.class.getName() + "(y,y);");
pigServer.openIterator("B");
} catch (Exception e) {
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertEquals(true, msg.contains("as multiple or none of them fit"));
}
}
示例8: test5
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void test5() throws Exception {
// Passing bytearrays
// Possible matches: (float, float) , (long, double)
// Throws exception since more than one funcSpec and inp is bytearray
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "';");
pigServer.registerQuery("B = FOREACH A generate $0, " + UDF1.class.getName()
+ "($1,$1);");
pigServer.openIterator("B");
} catch (Exception e) {
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertEquals(true, msg.contains("Multiple matching functions"));
}
}
示例9: testByteArrayCast1
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast1() throws IOException {
// Passing (float, bytearray)
// Ambiguous matches: (float, long) , (float, double)
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x:float, y);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y);");
pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("{float,double}, {float,long}"));
}
assertTrue(exceptionCaused);
}
示例10: testByteArrayCast5
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast5() throws IOException, ExecException {
// Passing (bytearray, int, int )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two ints cannot be unambiguously
// casted
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:int);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
}
assertTrue(exceptionCaused);
}
示例11: testByteArrayCast6
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast6() throws IOException, ExecException {
// Passing (bytearray, long, long )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two longs cannot be
// unambiguously casted
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:long);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
}
assertTrue(exceptionCaused);
}
示例12: testByteArrayCast7
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast7() throws IOException, ExecException {
// Passing (bytearray, double, double )
// Ambiguous matches: (float, long, double) , (float, double, long)
// bytearray can be casted to float but the two doubles cannot be
// casted with a permissible cast
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x, y:double);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Could not infer the matching function"));
}
assertTrue(exceptionCaused);
}
示例13: testByteArrayCast12
import org.apache.pig.PigException; //导入方法依赖的package包/类
@Test
public void testByteArrayCast12() throws IOException, ExecException {
// Passing (float, bytearray, int )
// Ambiguous matches: (float, long, double) , (float, double, long)
// will cause conflict since we could cast int to
// long or double and bytearray to long or double.
boolean exceptionCaused = false;
try {
pigServer.registerQuery("A = LOAD '" + inputFile2 + "' as (x:float, y, z:int);");
pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName()
+ "(x,y, y);");
pigServer.openIterator("B");
} catch (Exception e) {
exceptionCaused = true;
PigException pe = LogUtils.getPigException(e);
String msg = (pe == null ? e.getMessage() : pe.getMessage());
assertTrue(msg.contains("Multiple matching functions"));
assertTrue(msg.contains("({float,double,long}, {float,long,double}"));
}
assertTrue(exceptionCaused);
}
示例14: checkMessageInException
import org.apache.pig.PigException; //导入方法依赖的package包/类
public static void checkMessageInException(FrontendException e,
String expectedErr) {
PigException pigEx = LogUtils.getPigException(e);
String message = pigEx.getMessage();
checkErrorMessageContainsExpected(message, expectedErr);
}