当前位置: 首页>>代码示例>>Java>>正文


Java PigException.getMessage方法代码示例

本文整理汇总了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.");
    
   
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:23,代码来源:TestUnionOnSchema.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:19,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:22,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:22,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:21,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:22,代码来源:TestBestFitCast.java

示例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"));
    }

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:17,代码来源:TestBestFitCast.java

示例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"));
    }

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:18,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:19,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:22,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:22,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:21,代码来源:TestBestFitCast.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:22,代码来源:TestBestFitCast.java

示例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);

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:8,代码来源:Util.java


注:本文中的org.apache.pig.PigException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。