forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-1712] Remove "flink-staging" module
This closes apache#1492 This closes apache#1482
- Loading branch information
0 parents
commit b312709
Showing
100 changed files
with
10,527 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
main/java/org/apache/flink/api/java/table/package-info.java
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,60 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* <strong>Table API (Java)</strong><br> | ||
* | ||
* {@link org.apache.flink.api.java.table.TableEnvironment} can be used to create a | ||
* {@link org.apache.flink.api.table.Table} from a {@link org.apache.flink.api.java.DataSet} | ||
* or {@link org.apache.flink.streaming.api.datastream.DataStream}. | ||
* | ||
* <p> | ||
* This can be used to perform SQL-like queries on data. Please have | ||
* a look at {@link org.apache.flink.api.table.Table} to see which operations are supported and | ||
* how query strings are written. | ||
* | ||
* <p> | ||
* Example: | ||
* | ||
* <pre>{@code | ||
* ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment(); | ||
* | ||
* DataSet<WC> input = env.fromElements( | ||
* new WC("Hello", 1), | ||
* new WC("Ciao", 1), | ||
* new WC("Hello", 1)); | ||
* | ||
* Table table = TableUtil.from(input); | ||
* | ||
* Table filtered = table | ||
* .groupBy("word") | ||
* .select("word.count as count, word") | ||
* .filter("count = 2"); | ||
* | ||
* DataSet<WC> result = TableUtil.toSet(filtered, WC.class); | ||
* | ||
* result.print(); | ||
* env.execute(); | ||
* }</pre> | ||
* | ||
* <p> | ||
* As seen above, a {@link org.apache.flink.api.table.Table} can be converted back to the | ||
* underlying API representation using {@link org.apache.flink.api.java.table.TableEnvironment#toDataSet(org.apache.flink.api.table.Table, java.lang.Class)} | ||
* or {@link org.apache.flink.api.java.table.TableEnvironment#toDataStream(org.apache.flink.api.table.Table, java.lang.Class)}}. | ||
*/ | ||
package org.apache.flink.api.java.table; |
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,33 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* <strong>Table API</strong><br> | ||
* | ||
* This package contains the generic part of the Table API. It can be used with Flink Streaming | ||
* and Flink Batch. From Scala as well as from Java. | ||
* | ||
* When using the Table API, as user creates a [[org.apache.flink.api.table.Table]] from | ||
* a DataSet or DataStream. On this relational operations can be performed. A table can also | ||
* be converted back to a DataSet or DataStream. | ||
* | ||
* Packages [[org.apache.flink.api.scala.table]] and [[org.apache.flink.api.java.table]] contain | ||
* the language specific part of the API. Refer to these packages for documentation on how | ||
* the Table API can be used in Java and Scala. | ||
*/ | ||
package org.apache.flink.api.table; |
71 changes: 71 additions & 0 deletions
71
main/java/org/apache/flink/examples/java/JavaTableExample.java
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,71 @@ | ||
/* | ||
* 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.examples.java; | ||
|
||
|
||
import org.apache.flink.api.table.Table; | ||
import org.apache.flink.api.java.DataSet; | ||
import org.apache.flink.api.java.ExecutionEnvironment; | ||
import org.apache.flink.api.java.table.TableEnvironment; | ||
|
||
/** | ||
* Very simple example that shows how the Java Table API can be used. | ||
*/ | ||
public class JavaTableExample { | ||
|
||
public static class WC { | ||
public String word; | ||
public int count; | ||
|
||
// Public constructor to make it a Flink POJO | ||
public WC() { | ||
|
||
} | ||
|
||
public WC(String word, int count) { | ||
this.word = word; | ||
this.count = count; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "WC " + word + " " + count; | ||
} | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment(); | ||
TableEnvironment tableEnv = new TableEnvironment(); | ||
|
||
DataSet<WC> input = env.fromElements( | ||
new WC("Hello", 1), | ||
new WC("Ciao", 1), | ||
new WC("Hello", 1)); | ||
|
||
Table table = tableEnv.fromDataSet(input); | ||
|
||
Table filtered = table | ||
.groupBy("word") | ||
.select("word.count as count, word") | ||
.filter("count = 2"); | ||
|
||
DataSet<WC> result = tableEnv.toDataSet(filtered, WC.class); | ||
|
||
result.print(); | ||
} | ||
} |
Oops, something went wrong.