forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-4691] [table] Add group-windows for streaming tables to Table …
…API. This closes apache#2562.
- Loading branch information
Showing
69 changed files
with
3,996 additions
and
421 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...k-libraries/flink-table/src/main/scala/org/apache/flink/api/java/table/groupWindows.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.api.java.table | ||
|
||
import org.apache.flink.api.table.{SessionWindow, SlideWithSize, TumblingWindow} | ||
|
||
/** | ||
* Helper class for creating a tumbling window. Tumbling windows are consecutive, non-overlapping | ||
* windows of a specified fixed length. For example, a tumbling window of 5 minutes size groups | ||
* elements in 5 minutes intervals. | ||
*/ | ||
object Tumble { | ||
|
||
/** | ||
* Creates a tumbling window. Tumbling windows are consecutive, non-overlapping | ||
* windows of a specified fixed length. For example, a tumbling window of 5 minutes size groups | ||
* elements in 5 minutes intervals. | ||
* | ||
* @param size the size of the window as time or row-count interval. | ||
* @return a tumbling window | ||
*/ | ||
def over(size: String): TumblingWindow = new TumblingWindow(size) | ||
} | ||
|
||
/** | ||
* Helper class for creating a sliding window. Sliding windows have a fixed size and slide by | ||
* a specified slide interval. If the slide interval is smaller than the window size, sliding | ||
* windows are overlapping. Thus, an element can be assigned to multiple windows. | ||
* | ||
* For example, a sliding window of size 15 minutes with 5 minutes sliding interval groups elements | ||
* of 15 minutes and evaluates every five minutes. Each element is contained in three consecutive | ||
* window evaluations. | ||
*/ | ||
object Slide { | ||
|
||
/** | ||
* Creates a sliding window. Sliding windows have a fixed size and slide by | ||
* a specified slide interval. If the slide interval is smaller than the window size, sliding | ||
* windows are overlapping. Thus, an element can be assigned to multiple windows. | ||
* | ||
* For example, a sliding window of size 15 minutes with 5 minutes sliding interval groups | ||
* elements of 15 minutes and evaluates every five minutes. Each element is contained in three | ||
* consecutive window evaluations. | ||
* | ||
* @param size the size of the window as time or row-count interval | ||
* @return a partially specified sliding window | ||
*/ | ||
def over(size: String): SlideWithSize = new SlideWithSize(size) | ||
} | ||
|
||
/** | ||
* Helper class for creating a session window. The boundary of session windows are defined by | ||
* intervals of inactivity, i.e., a session window is closes if no event appears for a defined | ||
* gap period. | ||
*/ | ||
object Session { | ||
|
||
/** | ||
* Creates a session window. The boundary of session windows are defined by | ||
* intervals of inactivity, i.e., a session window is closes if no event appears for a defined | ||
* gap period. | ||
* | ||
* @param gap specifies how long (as interval of milliseconds) to wait for new data before | ||
* closing the session window. | ||
* @return a session window | ||
*/ | ||
def withGap(gap: String): SessionWindow = new SessionWindow(gap) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...-libraries/flink-table/src/main/scala/org/apache/flink/api/scala/table/groupWindows.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.api.scala.table | ||
|
||
import org.apache.flink.api.table.expressions.Expression | ||
import org.apache.flink.api.table.{SessionWindow, SlideWithSize, TumblingWindow} | ||
|
||
/** | ||
* Helper object for creating a tumbling window. Tumbling windows are consecutive, non-overlapping | ||
* windows of a specified fixed length. For example, a tumbling window of 5 minutes size groups | ||
* elements in 5 minutes intervals. | ||
*/ | ||
object Tumble { | ||
|
||
/** | ||
* Creates a tumbling window. Tumbling windows are fixed-size, consecutive, non-overlapping | ||
* windows. For example, a tumbling window of 5 minutes size groups | ||
* elements in 5 minutes intervals. | ||
* | ||
* @param size the size of the window as time or row-count interval. | ||
* @return a tumbling window | ||
*/ | ||
def over(size: Expression): TumblingWindow = new TumblingWindow(size) | ||
} | ||
|
||
/** | ||
* Helper object for creating a sliding window. Sliding windows have a fixed size and slide by | ||
* a specified slide interval. If the slide interval is smaller than the window size, sliding | ||
* windows are overlapping. Thus, an element can be assigned to multiple windows. | ||
* | ||
* For example, a sliding window of size 15 minutes with 5 minutes sliding interval groups elements | ||
* of 15 minutes and evaluates every five minutes. Each element is contained in three consecutive | ||
* window evaluations. | ||
*/ | ||
object Slide { | ||
|
||
/** | ||
* Creates a sliding window. Sliding windows have a fixed size and slide by | ||
* a specified slide interval. If the slide interval is smaller than the window size, sliding | ||
* windows are overlapping. Thus, an element can be assigned to multiple windows. | ||
* | ||
* For example, a sliding window of size 15 minutes with 5 minutes sliding interval groups | ||
* elements of 15 minutes and evaluates every five minutes. Each element is contained in three | ||
* consecutive | ||
* | ||
* @param size the size of the window as time or row-count interval | ||
* @return a partially specified sliding window | ||
*/ | ||
def over(size: Expression): SlideWithSize = new SlideWithSize(size) | ||
} | ||
|
||
/** | ||
* Helper object for creating a session window. The boundary of session windows are defined by | ||
* intervals of inactivity, i.e., a session window is closes if no event appears for a defined | ||
* gap period. | ||
*/ | ||
object Session { | ||
|
||
/** | ||
* Creates a session window. The boundary of session windows are defined by | ||
* intervals of inactivity, i.e., a session window is closes if no event appears for a defined | ||
* gap period. | ||
* | ||
* @param gap specifies how long (as interval of milliseconds) to wait for new data before | ||
* closing the session window. | ||
* @return a session window | ||
*/ | ||
def withGap(gap: Expression): SessionWindow = new SessionWindow(gap) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.