Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend Scala API #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,19 @@ class DataStream[T](stream: JavaStream[T]) {
}
filter(filterFun)
}

/** Creates a new DataStream that contains only the elements not satisfying the given filter predicate.
*/
def filterNot(fun: T => Boolean): DataStream[T] = {
if (fun == null) {
throw new NullPointerException("FilteNot function must not be null.")
}
val cleanFun = clean(fun)
val filterFun = new FilterFunction[T] {
def filter(in: T): Boolean = !cleanFun(in)
}
filter(filterFun)
}

/** Windows this [[DataStream]] into sliding count windows.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,15 @@ object StreamExecutionEnvironment {
new StreamExecutionEnvironment(JavaEnv.getExecutionEnvironment)
}

/** Creates an execution environment that represents the context in which the program is currently executed.
*
* @param configuration
* Pass a custom configuration into the cluster.
*/
def getExecutionEnvironment(configuration: Configuration): StreamExecutionEnvironment = {
new StreamExecutionEnvironment(JavaEnv.getExecutionEnvironment(configuration))
}

// --------------------------------------------------------------------------
// local environment
// --------------------------------------------------------------------------
Expand Down