You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jiayi (JIRA)" <ji...@apache.org> on 2018/04/01 13:10:00 UTC

[jira] [Comment Edited] (FLINK-7554) Add a testing RuntimeContext to test utilities

    [ https://issues.apache.org/jira/browse/FLINK-7554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16417779#comment-16417779 ] 

Jiayi edited comment on FLINK-7554 at 4/1/18 1:09 PM:
------------------------------------------------------

[~twalthr] 

I think I should let you know my idea about this issue before finishing the coding.

So.. Basically, there're two kinds of functions under "org.apache.flink.api.common.functions", one is the function that returns value like "MapFunction" and "FilterFunction", the other is the function without return like "FlatMapFunction". And for those without return, I'm going to implement a function to let developers to get its output.

And In order to make it work for both "streaming" and "batch" environments, I'm going to create two "TestContexts" which extend "RuntimeUDFContext" and "StreamingRuntimeContext", and develop several functions to let developers interact with "State", "Broadcast" and "Collectors".

And I'll make sure that every function is able to work with "TestContext" before I submit the pull request.
 # Do you have any suggestion about it ?
 # Should I write my tests for the "TestContext"? I'm not sure if I should do it because it'll be written in test package.


was (Author: wind_ljy):
[~twalthr] 

I think I should let you know my idea about this issue before finishing the coding.

So.. Basically, there're two kinds of functions under "org.apache.flink.api.common.functions", one is the function that returns value like "MapFunction" and "FilterFunction", the other is the function without return like "FlatMapFunction".

In order to make both of them work, I'm going to create a class called "TestRuntimeUDFContextBase" in the test scope, which extends "AbstractRuntimeUDFContext". And in this "TestRuntimeUDFContextBase", I will create several functions to let developers interact with "State", "Broadcast" and "Collectors" conveniently.

And I'll make sure that every function that belongs to package "org.apache.flink.api.common.functions", is compatible with the "TestRuntimeUDFContextBase" before I submit the pull request.
 # Do you have any suggestion about it ?
 # Should I write my tests for the "TestRuntimeUDFContextBase"? I am sure if I should do it because it'll be written in test package.

> Add a testing RuntimeContext to test utilities
> ----------------------------------------------
>
>                 Key: FLINK-7554
>                 URL: https://issues.apache.org/jira/browse/FLINK-7554
>             Project: Flink
>          Issue Type: New Feature
>          Components: Tests
>            Reporter: Timo Walther
>            Assignee: Jiayi
>            Priority: Major
>              Labels: starter
>
> When unit testing user-defined functions it would be useful to have an official testing {{RuntimeContext}} that uses Java collections for storing state, metrics, etc.
> After executing the business logic, the user could then verify how the state of the UDF changed or which metrics have been collected.
> This issue includes documentation for the "Testing" section.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)