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


Java DoFnTester.peekOutputElements方法代码示例

本文整理汇总了Java中org.apache.beam.sdk.transforms.DoFnTester.peekOutputElements方法的典型用法代码示例。如果您正苦于以下问题:Java DoFnTester.peekOutputElements方法的具体用法?Java DoFnTester.peekOutputElements怎么用?Java DoFnTester.peekOutputElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.beam.sdk.transforms.DoFnTester的用法示例。


在下文中一共展示了DoFnTester.peekOutputElements方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkSimpleInputValidOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkSimpleInputValidOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(1, outputs.size());
    assertEquals("aaa", outputs.get(0).get(0));
    assertEquals("BBB", outputs.get(0).get(1));
    assertEquals("Ccc", outputs.get(0).get(2));
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());
}
 
开发者ID:Talend,项目名称:components,代码行数:10,代码来源:FilterRowDoFnTest.java

示例2: checkSimpleInputInvalidOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkSimpleInputInvalidOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(0, outputs.size());
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(1, rejects.size());
    assertEquals("aaa", rejects.get(0).get(0));
    assertEquals("BBB", rejects.get(0).get(1));
    assertEquals("Ccc", rejects.get(0).get(2));
}
 
开发者ID:Talend,项目名称:components,代码行数:10,代码来源:FilterRowDoFnTest.java

示例3: checkNumericInputValidOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkNumericInputValidOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputNumericRecord);
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(1, outputs.size());
    assertEquals(10, outputs.get(0).get(0));
    assertEquals(-100, outputs.get(0).get(1));
    assertEquals(1000, outputs.get(0).get(2));
    assertEquals(0, rejects.size());
}
 
开发者ID:Talend,项目名称:components,代码行数:10,代码来源:FilterRowDoFnTest.java

示例4: checkNumericInputInvalidOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkNumericInputInvalidOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputNumericRecord);
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, outputs.size());
    assertEquals(1, rejects.size());
    assertEquals(10, rejects.get(0).get(0));
    assertEquals(-100, rejects.get(0).get(1));
    assertEquals(1000, rejects.get(0).get(2));
}
 
开发者ID:Talend,项目名称:components,代码行数:10,代码来源:FilterRowDoFnTest.java

示例5: test_FilterBetween

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
@Test
public void test_FilterBetween() throws Exception {
    FilterRowProperties properties = new FilterRowProperties("test");
    properties.init();
    FilterRowCriteriaProperties filterGreater = new FilterRowCriteriaProperties("filter1");
    filterGreater.init();
    filterGreater.columnName.setValue("a");
    filterGreater.operator.setValue(ConditionsRowConstant.Operator.GREATER);
    filterGreater.value.setValue("10");
    properties.filters.addRow(filterGreater);
    FilterRowCriteriaProperties filterLess = new FilterRowCriteriaProperties("filter2");
    filterLess.init();
    filterLess.columnName.setValue("a");
    filterLess.operator.setValue(ConditionsRowConstant.Operator.LOWER);
    filterLess.value.setValue("30");
    properties.filters.addRow(filterLess);

    FilterRowDoFn function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(true).withRejectSchema(true);
    DoFnTester<Object, IndexedRecord> fnTester = DoFnTester.of(function);

    List<IndexedRecord> outputs = fnTester.processBundle(input_30_300_3000_Record, input_10_100_1000_Record,
            input_20_200_2000_Record);
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);

    assertEquals(1, outputs.size());
    assertEquals(2, rejects.size());

}
 
开发者ID:Talend,项目名称:components,代码行数:30,代码来源:FilterRowDoFnTest.java

示例6: test_FilterLogicalOpAny

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
@Test
public void test_FilterLogicalOpAny() throws Exception {
    FilterRowProperties properties = new FilterRowProperties("test");
    properties.init();
    properties.logicalOp.setValue(LogicalOpType.ANY);
    FilterRowCriteriaProperties condition1 = new FilterRowCriteriaProperties("filter1");
    condition1.init();
    condition1.columnName.setValue("a");
    condition1.operator.setValue(ConditionsRowConstant.Operator.EQUAL);
    condition1.value.setValue("10");
    properties.filters.addRow(condition1);
    FilterRowCriteriaProperties condition2 = new FilterRowCriteriaProperties("filter2");
    condition2.init();
    condition2.columnName.setValue("b");
    condition2.operator.setValue(ConditionsRowConstant.Operator.EQUAL);
    condition2.value.setValue("300");
    properties.filters.addRow(condition2);

    FilterRowDoFn function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(true).withRejectSchema(true);
    DoFnTester<Object, IndexedRecord> fnTester = DoFnTester.of(function);

    List<IndexedRecord> outputs = fnTester.processBundle(input_30_300_3000_Record, input_10_100_1000_Record,
            input_20_200_2000_Record);
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);

    assertEquals(2, outputs.size());
    assertEquals(30, outputs.get(0).get(0));
    assertEquals(10, outputs.get(1).get(0));
    assertEquals(1, rejects.size());
    assertEquals(20, rejects.get(0).get(0));
}
 
开发者ID:Talend,项目名称:components,代码行数:33,代码来源:FilterRowDoFnTest.java

示例7: test_FilterLogicalOpNone

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
@Test
public void test_FilterLogicalOpNone() throws Exception {
    FilterRowProperties properties = new FilterRowProperties("test");
    properties.init();
    properties.logicalOp.setValue(LogicalOpType.NONE);
    FilterRowCriteriaProperties condition1 = new FilterRowCriteriaProperties("filter1");
    condition1.init();
    condition1.columnName.setValue("a");
    condition1.operator.setValue(ConditionsRowConstant.Operator.EQUAL);
    condition1.value.setValue("10");
    properties.filters.addRow(condition1);
    FilterRowCriteriaProperties condition2 = new FilterRowCriteriaProperties("filter2");
    condition2.init();
    condition2.columnName.setValue("b");
    condition2.operator.setValue(ConditionsRowConstant.Operator.EQUAL);
    condition2.value.setValue("100");
    properties.filters.addRow(condition2);
    FilterRowCriteriaProperties condition3 = new FilterRowCriteriaProperties("filter3");
    condition3.init();
    condition3.columnName.setValue("a");
    condition3.operator.setValue(ConditionsRowConstant.Operator.EQUAL);
    condition3.value.setValue("20");
    properties.filters.addRow(condition3);

    FilterRowDoFn function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(true).withRejectSchema(true);
    DoFnTester<Object, IndexedRecord> fnTester = DoFnTester.of(function);

    List<IndexedRecord> outputs = fnTester.processBundle(input_30_300_3000_Record, input_10_100_1000_Record,
            input_20_200_2000_Record);
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);

    assertEquals(1, outputs.size());
    assertEquals(2, rejects.size());

}
 
开发者ID:Talend,项目名称:components,代码行数:37,代码来源:FilterRowDoFnTest.java

示例8: checkSimpleInputNoOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkSimpleInputNoOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(0, outputs.size());
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());
}
 
开发者ID:Talend,项目名称:components,代码行数:7,代码来源:FilterRowDoFnTest.java

示例9: checkNumericInputNoOutput

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
private void checkNumericInputNoOutput(DoFnTester<Object, IndexedRecord> fnTester) throws Exception {
    List<IndexedRecord> outputs = fnTester.processBundle(inputNumericRecord);
    assertEquals(0, outputs.size());
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());
}
 
开发者ID:Talend,项目名称:components,代码行数:7,代码来源:FilterRowDoFnTest.java

示例10: test_FilterSimple_utf8

import org.apache.beam.sdk.transforms.DoFnTester; //导入方法依赖的package包/类
@Test
public void test_FilterSimple_utf8() throws Exception {

    FilterRowProperties properties = new FilterRowProperties("test");
    properties.init();
    FilterRowCriteriaProperties filterProp = new FilterRowCriteriaProperties("filter");
    filterProp.init();
    properties.schemaListener.afterSchema();
    filterProp.columnName.setValue("a");
    filterProp.value.setValue("aaa");
    properties.filters.addRow(filterProp);

    FilterRowDoFn function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(false).withRejectSchema(false);
    DoFnTester<Object, IndexedRecord> fnTester = DoFnTester.of(function);
    checkSimpleInputNoOutput(fnTester);

    Schema inputSimpleSchema = SchemaBuilder.record("inputRow") //
            .fields() //
            .name("a").type().optional().stringType() //
            .name("b").type().optional().stringType() //
            .name("c").type().optional().stringType() //
            .endRecord();

    GenericRecord inputSimpleRecord = new GenericRecordBuilder(inputSimpleSchema) //
            .set("a", new Utf8("aaa")) //
            .set("b", new Utf8("BBB")) //
            .set("c", new Utf8("Ccc")) //
            .build();

    function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(true).withRejectSchema(false);
    fnTester = DoFnTester.of(function);
    List<IndexedRecord> outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(1, outputs.size());
    assertEquals(new Utf8("aaa"), outputs.get(0).get(0));
    assertEquals(new Utf8("BBB"), outputs.get(0).get(1));
    assertEquals(new Utf8("Ccc"), outputs.get(0).get(2));
    List<IndexedRecord> rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());

    function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(true).withRejectSchema(true);
    fnTester = DoFnTester.of(function);
    outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(1, outputs.size());
    assertEquals(new Utf8("aaa"), outputs.get(0).get(0));
    assertEquals(new Utf8("BBB"), outputs.get(0).get(1));
    assertEquals(new Utf8("Ccc"), outputs.get(0).get(2));
    rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());

    function = new FilterRowDoFn().withProperties(properties) //
            .withOutputSchema(false).withRejectSchema(true);
    fnTester = DoFnTester.of(function);
    outputs = fnTester.processBundle(inputSimpleRecord);
    assertEquals(0, outputs.size());
    rejects = fnTester.peekOutputElements(FilterRowRuntime.rejectOutput);
    assertEquals(0, rejects.size());
}
 
开发者ID:Talend,项目名称:components,代码行数:61,代码来源:FilterRowDoFnTest.java


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