Skip to content

[Native] Pass Configs to Type Manager#26001

Draft
saitejagoruganthu wants to merge 1 commit intoprestodb:masterfrom
saitejagoruganthu:support/T-3825-pass-configs-nativetypemanager
Draft

[Native] Pass Configs to Type Manager#26001
saitejagoruganthu wants to merge 1 commit intoprestodb:masterfrom
saitejagoruganthu:support/T-3825-pass-configs-nativetypemanager

Conversation

@saitejagoruganthu
Copy link

@saitejagoruganthu saitejagoruganthu commented Sep 9, 2025

Description

Added support for passing down configuration properties to NativeTypeManager during initialization.

Motivation and Context

Currently, the NativeTypeManager does not accept or propagate configuration properties during initialization. This change enables the NativeTypeManager to receive and utilize configuration properties (specifically HTTP client configuration) similar to other components in the system like NativeSystemSessionPropertyProvider and NativeFunctionDefinitionProvider.

#25894

Test Plan

  • Added test case in testHttpClientProperties() method to verify that the sidecar.http-client.max-content-length configuration property is properly passed down to NativeTypeManager

  • Test verifies that the NativeTypeManager's HttpClient has the correct max content length configuration

  • Test follows the same pattern as existing tests for NativeSystemSessionPropertyProvider and NativeFunctionDefinitionProvider

  • All existing tests continue to pass, ensuring no regression

== NO RELEASE NOTE ==

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Sep 9, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 9, 2025

CLA Signed

  • ✅login: saitejagoruganthu / name: Saiteja Goruganthu / (6f098e4)

The committers listed above are authorized under a signed CLA.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 9, 2025

Reviewer's Guide

This PR extends the TypeManager loading path to accept configuration properties across the SPI, core engine, and testing layers, and integrates HTTP client configuration into the native sidecar type manager with corresponding injection and verification in tests.

Sequence diagram for TypeManager loading with configuration properties

sequenceDiagram
    participant StaticTypeManagerStore
    participant FunctionAndTypeManager
    participant TypeManagerFactory
    participant NativeTypeManagerFactory
    participant NativeTypeManager
    participant HttpClient

    StaticTypeManagerStore->>FunctionAndTypeManager: loadTypeManager(typeManagerName, properties)
    FunctionAndTypeManager->>TypeManagerFactory: create(TypeManagerContext, properties)
    TypeManagerFactory->>NativeTypeManagerFactory: create(TypeManagerContext, properties)
    NativeTypeManagerFactory->>NativeTypeManager: NativeTypeManager(TypeManager, HttpClient)
    NativeTypeManager->>HttpClient: (injected)
    NativeTypeManager-->>NativeTypeManagerFactory: instance returned
    NativeTypeManagerFactory-->>TypeManagerFactory: instance returned
    TypeManagerFactory-->>FunctionAndTypeManager: instance returned
    FunctionAndTypeManager-->>StaticTypeManagerStore: registration complete
Loading

Class diagram for updated TypeManagerFactory and related classes

classDiagram
    class TypeManagerFactory {
        <<interface>>
        +String getName()
        +TypeManager create(TypeManagerContext context, Map<String, String> config)
    }
    class NativeTypeManagerFactory {
        +String getName()
        +TypeManager create(TypeManagerContext context, Map<String, String> config)
    }
    TypeManagerFactory <|.. NativeTypeManagerFactory
    class NativeTypeManager {
        +NativeTypeManager(TypeManager typeManager, HttpClient httpClient)
        +HttpClient getHttpClient()
    }
    class TypeManagerContext {
        +TypeManager getTypeManager()
    }
    class FunctionAndTypeManager {
        +void loadTypeManager(String typeManagerName, Map<String, String> properties)
        +Map<String, TypeManager> getTypeManagers()
    }
    class StaticTypeManagerStore {
        -void loadTypeManager(String catalogName, Map<String, String> properties)
    }
    class QueryRunner {
        +void loadTypeManager(String typeManagerName, Map<String, String> properties)
    }
    NativeTypeManagerFactory --> NativeTypeManager
    NativeTypeManagerFactory --> TypeManagerContext
    NativeTypeManager --> HttpClient
    FunctionAndTypeManager --> TypeManager
    StaticTypeManagerStore --> FunctionAndTypeManager
    QueryRunner --> FunctionAndTypeManager
Loading

Class diagram for NativeTypeManager with injected HttpClient

classDiagram
    class NativeTypeManager {
        +NativeTypeManager(TypeManager typeManager, HttpClient httpClient)
        +HttpClient getHttpClient()
        -TypeManager typeManager
        -HttpClient httpClient
    }
    NativeTypeManager --> HttpClient
Loading

File-Level Changes

Change Details Files
Extend loadTypeManager to pass configuration properties
  • Added Map<String, String> properties parameter to FunctionAndTypeManager.loadTypeManager and QueryRunner.loadTypeManager
  • Updated TypeManagerFactory SPI to include config in create() signature
  • Propagated config parameter to DistributedQueryRunner and StaticTypeManagerStore loadTypeManager
presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java
presto-spi/src/main/java/com/facebook/presto/spi/type/TypeManagerFactory.java
presto-main-base/src/main/java/com/facebook/presto/testing/QueryRunner.java
presto-tests/src/main/java/com/facebook/presto/tests/DistributedQueryRunner.java
presto-main-base/src/main/java/com/facebook/presto/metadata/StaticTypeManagerStore.java
Inject and expose HTTP client in native sidecar TypeManager
  • Added HttpClient constructor parameter and getHttpClient() method in NativeTypeManager
  • Updated NativeTypeManagerFactory.create() to accept config and set Guice properties via setRequiredConfigurationProperties
presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/typemanager/NativeTypeManager.java
presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/typemanager/NativeTypeManagerFactory.java
Update native sidecar plugin tests to pass and verify configs
  • Modified TestNativeSidecarPlugin to call loadTypeManager with properties and assert HttpClient settings
  • Updated NativeSidecarPluginQueryRunnerUtils to invoke loadTypeManager with an empty config map
presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java
presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/NativeSidecarPluginQueryRunnerUtils.java

Possibly linked issues

  • Add simple HashAggregation #1: The PR modifies TypeManagerFactory and its consumers to accept and propagate configuration properties to NativeTypeManager.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@saitejagoruganthu saitejagoruganthu force-pushed the support/T-3825-pass-configs-nativetypemanager branch from e750f08 to 6f098e4 Compare September 9, 2025 21:05
@saitejagoruganthu saitejagoruganthu changed the title Pass Configs [Native] Pass Configs to Type Manager Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants