Skip to content
Closed
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 @@ -71,6 +71,7 @@
p.run().waitUntilFinish();
* }
* </pre>
*
*/
@Experimental
public class BeamSql {
Expand All @@ -82,8 +83,14 @@ public class BeamSql {
* table. The {@link PCollectionTuple} contains the mapping from {@code table names} to
* {@code PCollection<BeamSqlRow>}, each representing an input table.
*
* <p>It is an error to apply a {@link PCollectionTuple} missing any {@code table names}
* referenced within the query.
* <ul>
* <li>If the sql query only use a subset of tables from the upstream {@link PCollectionTuple},
* it succeed;</li>
* <li>If sql query use a table which is not covered by upstream {@link PCollectionTuple},
* an {@code IllegalStateException} is thrown during query validation;</li>
* <li>Always, tables from upstream {@link PCollectionTuple} are only valid in the scope
* of the current query call.</li>
* </ul>
*/
public static QueryTransform query(String sqlQuery) {
return QueryTransform.builder()
Expand All @@ -100,7 +107,7 @@ public static QueryTransform query(String sqlQuery) {
*
* <p>Make sure to query it from a static table name <em>PCOLLECTION</em>.
*/
public static SimpleQueryTransform simpleQuery(String sqlQuery) throws Exception {
public static SimpleQueryTransform simpleQuery(String sqlQuery) {
return SimpleQueryTransform.builder()
.setSqlEnv(new BeamSqlEnv())
.setSqlQuery(sqlQuery)
Expand All @@ -109,6 +116,9 @@ public static SimpleQueryTransform simpleQuery(String sqlQuery) throws Exception

/**
* A {@link PTransform} representing an execution plan for a SQL query.
*
* <p>The lifetime of tables in the input {@code PCollectionTuple} are only valid during current
* query.
*/
@AutoValue
public abstract static class QueryTransform extends
Expand Down