prajwal-jadhav01 commented on code in PR #20121:
URL: https://github.com/apache/pinot/pull/20121#discussion_r4577363002
##########
pinot-connectors/pinot-flink-connector/src/main/java/org/apache/pinot/connector/flink/sink/PinotSink.java:
##########
@@ -137,6 +172,25 @@ static TableConfig prepareTableConfigForSink(TableConfig
tableConfig, String con
return tableConfig;
}
+ /// Builds an [AuthProvider] from the `authToken` in the table's batch
config, or returns null if none is set.
+ ///
+ /// Prefer passing the token to [#PinotSink(PinotGenericRowConverter,
TableConfig, Schema, String, String)]. Never
+ /// store it in the table config saved on the controller: that config is
kept in ZooKeeper and returned by the table
+ /// APIs.
+ @Nullable
+ static AuthProvider createAuthProvider(TableConfig tableConfig) {
+ IngestionConfig ingestionConfig = tableConfig.getIngestionConfig();
+ if (ingestionConfig == null || ingestionConfig.getBatchIngestionConfig()
== null) {
+ return null;
+ }
+ List<Map<String, String>> batchConfigMaps =
ingestionConfig.getBatchIngestionConfig().getBatchConfigMaps();
+ if (batchConfigMaps == null || batchConfigMaps.isEmpty()) {
+ return null;
+ }
+ String authToken =
batchConfigMaps.get(0).get(BatchConfigProperties.AUTH_TOKEN);
+ return StringUtils.isBlank(authToken) ? null :
AuthProviderUtils.makeAuthProvider(authToken);
Review Comment:
Done. `createAuthProvider` now always delegates to
`AuthProviderUtils.makeAuthProvider`, so the writer's provider is non-null
(`NullAuthProvider` when there's no token, which uploads exactly as `null` did
before). The tests assert empty request headers for the no-credential cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]