jnturton commented on code in PR #2668:
URL: https://github.com/apache/drill/pull/2668#discussion_r985392330


##########
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/util/SimpleHttp.java:
##########
@@ -832,8 +835,36 @@ public static List<String> 
buildParameterList(NullableVarCharHolder[] inputReade
     return inputArguments;
   }
 
-  public static HttpApiConfig getEndpointConfig(String endpoint, 
HttpStoragePluginConfig pluginConfig) {
-    HttpApiConfig endpointConfig = pluginConfig.getConnection(endpoint);
+  /**
+   * This function is used to obtain the configuration information for a given 
API in the HTTP UDF.
+   * If aliasing is enabled, this function will resolve aliases for 
connections.
+   * @param endpoint The name of the endpoint.  Should be a {@link String}
+   * @param context The {@link DrillbitContext} from the current query.
+   * @param info {@link ContextInformation} from the current query.
+   * @param pluginConfig The {@link HttpStoragePluginConfig} the configuration 
from the plugin
+   * @return The {@link HttpApiConfig} corresponding with the endpoint.
+   */
+  public static HttpApiConfig getEndpointConfig(String endpoint,
+                                                DrillbitContext context,
+                                                ContextInformation info,
+                                                HttpStoragePluginConfig 
pluginConfig) {
+    String queryUser = info.getQueryUser();
+    AliasRegistryProvider aliasRegistryProvider = 
context.getAliasRegistryProvider();

Review Comment:
   It would be nice to get @vvysotskyi's feedback here but maybe it would be 
nicer to create one or more new UDFs along the lines of 
`resolve_storage_alias(VARCHAR alias)` instead of rewriting this alias 
resolution code in UDFs that have other, specific purposes. I guess doing that 
would mean `select http_request('storage_alias')` would have to become `select 
http_request(resolve_storage_alias(VARCHAR alias))`. On the other hand, perhaps 
so few UDFs will ever require alias resolution that the present approach is 
better.



##########
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/util/SimpleHttp.java:
##########
@@ -832,8 +835,36 @@ public static List<String> 
buildParameterList(NullableVarCharHolder[] inputReade
     return inputArguments;
   }
 
-  public static HttpApiConfig getEndpointConfig(String endpoint, 
HttpStoragePluginConfig pluginConfig) {
-    HttpApiConfig endpointConfig = pluginConfig.getConnection(endpoint);
+  /**
+   * This function is used to obtain the configuration information for a given 
API in the HTTP UDF.
+   * If aliasing is enabled, this function will resolve aliases for 
connections.
+   * @param endpoint The name of the endpoint.  Should be a {@link String}
+   * @param context The {@link DrillbitContext} from the current query.
+   * @param info {@link ContextInformation} from the current query.
+   * @param pluginConfig The {@link HttpStoragePluginConfig} the configuration 
from the plugin
+   * @return The {@link HttpApiConfig} corresponding with the endpoint.
+   */
+  public static HttpApiConfig getEndpointConfig(String endpoint,
+                                                DrillbitContext context,
+                                                ContextInformation info,
+                                                HttpStoragePluginConfig 
pluginConfig) {
+    String queryUser = info.getQueryUser();
+    AliasRegistryProvider aliasRegistryProvider = 
context.getAliasRegistryProvider();

Review Comment:
   It would be nice to get @vvysotskyi's feedback here but maybe it would be 
nicer to create one or more new UDFs along the lines of 
`resolve_storage_alias(VARCHAR alias)` instead of rewriting this alias 
resolution code in UDFs that have other, specific purposes. I guess doing that 
would mean `select http_request('some_storage_alias')` would have to become 
`select http_request(resolve_storage_alias('some_storage_alias'))`. On the 
other hand, perhaps so few UDFs will ever require alias resolution that the 
present approach is better.



-- 
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: dev-unsubscr...@drill.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to