@@ -131,7 +131,7 @@ public void flush(Map<TopicPartition, OffsetAndMetadata> offsets) {
131
131
topicPartitionManager .resumeAll ();
132
132
}
133
133
134
- private PartitionedTableId getRecordTable (SinkRecord record , boolean autoCreateTables ) {
134
+ private PartitionedTableId getRecordTable (SinkRecord record ) {
135
135
// Dynamically update topicToBaseTableIds mapping. topicToBaseTableIds was used to be
136
136
// constructed when connector starts hence new topic configuration needed connector to restart.
137
137
// Dynamic update shall not require connector restart and shall compute table id in runtime.
@@ -141,7 +141,7 @@ private PartitionedTableId getRecordTable(SinkRecord record, boolean autoCreateT
141
141
142
142
TableId baseTableId = topicsToBaseTableIds .get (record .topic ());
143
143
144
- maybeCreateTable (record , baseTableId , autoCreateTables );
144
+ maybeCreateTable (record , baseTableId );
145
145
146
146
PartitionedTableId .Builder builder = new PartitionedTableId .Builder (baseTableId );
147
147
if (useMessageTimeDatePartitioning ) {
@@ -162,10 +162,10 @@ private PartitionedTableId getRecordTable(SinkRecord record, boolean autoCreateT
162
162
* Create the table which doesn't exist in BigQuery for a (record's) topic when autoCreateTables config is set to true.
163
163
* @param record Kafka Sink Record to be streamed into BigQuery.
164
164
* @param baseTableId BaseTableId in BigQuery.
165
- * @param autoCreateTables If this config is set to true, auto-creating the table that doesn't not exist.
166
165
*/
167
- private void maybeCreateTable (SinkRecord record , TableId baseTableId , boolean autoCreateTables ) {
166
+ private void maybeCreateTable (SinkRecord record , TableId baseTableId ) {
168
167
BigQuery bigQuery = getBigQuery ();
168
+ boolean autoCreateTables = config .getBoolean (config .TABLE_CREATE_CONFIG );
169
169
if (autoCreateTables && bigQuery .getTable (baseTableId ) == null ) {
170
170
getSchemaManager (bigQuery ).createTable (baseTableId , record .topic ());
171
171
logger .info ("Table {} does not exist, auto-created table for topic {}" , baseTableId , record .topic ());
@@ -202,11 +202,9 @@ public void put(Collection<SinkRecord> records) {
202
202
// create tableWriters
203
203
Map <PartitionedTableId , TableWriterBuilder > tableWriterBuilders = new HashMap <>();
204
204
205
- boolean autoCreateTables = config .getBoolean (config .TABLE_CREATE_CONFIG );
206
-
207
205
for (SinkRecord record : records ) {
208
206
if (record .value () != null ) {
209
- PartitionedTableId table = getRecordTable (record , autoCreateTables );
207
+ PartitionedTableId table = getRecordTable (record );
210
208
if (schemaRetriever != null ) {
211
209
schemaRetriever .setLastSeenSchema (table .getBaseTableId (),
212
210
record .topic (),
0 commit comments