@@ -30,15 +30,9 @@ import org.apache.beam.sdk.io.Compression
3030import org .apache .beam .sdk .io .gcp .bigquery .BigQueryIO .TypedRead .Method
3131import org .apache .beam .sdk .io .fs .EmptyMatchTreatment
3232import org .apache .beam .sdk .transforms .errorhandling .{BadRecord , ErrorHandler }
33- import org .slf4j .{Logger , LoggerFactory }
34-
35- object ScioContextOps {
36- @ transient private lazy val logger : Logger = LoggerFactory .getLogger(this .getClass)
37- }
3833
3934/** Enhanced version of [[ScioContext ]] with BigQuery methods. */
4035final class ScioContextOps (private val self : ScioContext ) extends AnyVal {
41- import ScioContextOps ._
4236
4337 /**
4438 * Get an SCollection for a BigQuery SELECT query. Both
@@ -85,13 +79,10 @@ final class ScioContextOps(private val self: ScioContext) extends AnyVal {
8579 configOverride : BigQueryIO .ReadParam .ConfigOverride [TableRow ] =
8680 BigQueryIO .ReadParam .DefaultConfigOverride
8781 ): SCollection [TableRow ] = {
88- if (table.filter.nonEmpty) {
89- logger.warn(
90- " Using filtered table with standard API. " +
91- " selectedFields and rowRestriction are ignored. " +
92- " Use bigQueryStorage instead"
93- )
94- }
82+ require(
83+ table.filter.isEmpty,
84+ " Cannot use filtered table with standard API. Use bigQueryStorage instead"
85+ )
9586 val params = BigQueryIO .TableReadParam (
9687 BigQueryIO .Format .Default (),
9788 Method .DEFAULT ,
@@ -107,13 +98,10 @@ final class ScioContextOps(private val self: ScioContext) extends AnyVal {
10798 configOverride : BigQueryIO .ReadParam .ConfigOverride [T ] =
10899 BigQueryIO .ReadParam .DefaultConfigOverride
109100 ): SCollection [T ] = {
110- if (table.filter.nonEmpty) {
111- logger.warn(
112- " Using filtered table with standard API. " +
113- " selectedFields and rowRestriction are ignored. " +
114- " Use bigQueryStorage instead"
115- )
116- }
101+ require(
102+ table.filter.isEmpty,
103+ " Cannot use filtered table with standard API. Use bigQueryStorage instead"
104+ )
117105 val params = BigQueryIO .TableReadParam (
118106 format,
119107 Method .DEFAULT ,
@@ -123,23 +111,6 @@ final class ScioContextOps(private val self: ScioContext) extends AnyVal {
123111 self.read(BigQueryIO [T ](table))(params)
124112 }
125113
126- /**
127- * Get an SCollection for a BigQuery table using the storage API.
128- *
129- * @param selectedFields
130- * names of the fields in the table that should be read. If empty, all fields will be read. If
131- * the specified field is a nested field, all the sub-fields in the field will be selected.
132- * Fields will always appear in the generated class in the same order as they appear in the
133- * table, regardless of the order specified in selectedFields.
134- * @param rowRestriction
135- * SQL text filtering statement, similar ti a WHERE clause in a query. Currently, we support
136- * combinations of predicates that are a comparison between a column and a constant value in SQL
137- * statement. Aggregates are not supported. For example:
138- *
139- * {{{
140- * "a > DATE '2014-09-27' AND (b > 5 AND c LIKE 'date')"
141- * }}}
142- */
143114 def bigQueryStorage (
144115 table : Table ,
145116 errorHandler : ErrorHandler [BadRecord , _] = BigQueryIO .ReadParam .DefaultErrorHandler ,
0 commit comments