本文整理匯總了Java中org.apache.pig.piggybank.evaluation.decode.BinCond類的典型用法代碼示例。如果您正苦於以下問題:Java BinCond類的具體用法?Java BinCond怎麽用?Java BinCond使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BinCond類屬於org.apache.pig.piggybank.evaluation.decode包,在下文中一共展示了BinCond類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testBinCond
import org.apache.pig.piggybank.evaluation.decode.BinCond; //導入依賴的package包/類
@Test
public void testBinCond() throws Exception {
Tuple t1 = TupleFactory.getInstance().newTuple(7);
t1.set(0, false);
t1.set(1, "s&a");
t1.set(2, false);
t1.set(3, "a");
t1.set(4, true);
t1.set(5, "s");
t1.set(6, "n");
Tuple t2 = TupleFactory.getInstance().newTuple(7);
t2.set(0, null);
t2.set(1, "s&a");
t2.set(2, false);
t2.set(3, "a");
t2.set(4, true);
t2.set(5, "s");
t2.set(6, "n");
Tuple t3 = TupleFactory.getInstance().newTuple(7);
t3.set(0, false);
t3.set(1, "s&a");
t3.set(2, null);
t3.set(3, "a");
t3.set(4, true);
t3.set(5, "s");
t3.set(6, "n");
BinCond func = new BinCond();
String r = func.exec(t1);
assertTrue(r.equals("s"));
r = func.exec(t2);
assertTrue(r==null);
try {
r = func.exec(t3);
fail("Exception not triggered");
} catch (IOException e) {
assertTrue(e.getMessage().equals("BinCond : Encounter null in the input"));
}
}