Skip to content

Conversation

@pramodsatya
Copy link
Contributor

@pramodsatya pramodsatya commented Sep 25, 2025

Description

Cleans up tests from presto-native-tests.

Motivation and Context

implicitCastCharNToVarchar config is not toggled in any of the native-tests and should not be a parameter in the tests.
Helper methods used to test custom functions are only used in TestCustomFunctions and should not be a part of NativeTestUtils.
Builder pattern should be used to get the queryRunner used in tests and function NativeTestUtils.createNativeQueryRunner should not be overloaded with different arguments.

Impact

NA

== NO RELEASE NOTE ==

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Sep 25, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 25, 2025

Reviewer's Guide

This PR streamlines the native test suite by removing the unused implicitCastCharNToVarchar toggle, consolidating query runner creation through a builder pattern, and moving custom-functions helpers into their dedicated test class.

File-Level Changes

Change Details Files
Pruned implicitCharNToVarchar toggle from native test utilities
  • Removed the boolean charNToVarcharImplicitCast parameter from createNativeQueryRunner
  • Deleted overloaded createNativeQueryRunner methods and getCharNToVarcharImplicitCastForTest helper
  • Eliminated char-to-varchar implicit cast setting in nativeHiveQueryRunnerBuilder usage
presto-native-tests/src/test/java/com/facebook/presto/nativetests/NativeTestsUtils.java
Refactored builder to drop implicitCastCharNToVarchar support
  • Removed implicitCastCharNToVarchar field and setter from HiveQueryRunnerBuilder
  • Updated getExternalWorkerLauncher calls to remove cast toggle parameter
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/PrestoNativeQueryRunnerUtils.java
Isolated custom-functions helpers into TestCustomFunctions
  • Moved getCustomFunctionsPluginDirectory and findPrestoRoot into TestCustomFunctions
  • Replaced NativeTestsUtils.createNativeQueryRunner with nativeHiveQueryRunnerBuilder and setupNativeSidecarPlugin
  • Added necessary imports and Optional usage for pluginDirectory
presto-native-tests/src/test/java/com/facebook/presto/nativetests/TestCustomFunctions.java
Simplified aggregation tests by removing conditional char-cast logic
  • Dropped implicitCastCharNToVarchar field and init parameter from AbstractTestAggregationsNative
  • Replaced conditional branches with assertQueryFails for CHAR casts
  • Updated TestAggregations and TestOptimizeMixedDistinctAggregations to match new init and createQueryRunner signatures
presto-native-tests/src/test/java/com/facebook/presto/nativetests/AbstractTestAggregationsNative.java
presto-native-tests/src/test/java/com/facebook/presto/nativetests/TestAggregations.java
presto-native-tests/src/test/java/com/facebook/presto/nativetests/TestOptimizeMixedDistinctAggregations.java

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

@pramodsatya pramodsatya force-pushed the cleanup_tests branch 2 times, most recently from 46e8e92 to 207b037 Compare October 31, 2025 04:51
@pramodsatya pramodsatya changed the title [native] Cleanup tests chore: Cleanup native tests Oct 31, 2025
@pramodsatya pramodsatya marked this pull request as ready for review November 1, 2025 00:08
@pramodsatya pramodsatya requested review from a team as code owners November 1, 2025 00:08
@prestodb-ci prestodb-ci requested review from a team, Joe-Abraham and namya28 and removed request for a team November 1, 2025 00:08
@pramodsatya pramodsatya requested review from a team, aditi-pandit and sh-shamsan and removed request for a team, Joe-Abraham and namya28 November 1, 2025 00:08
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

if (this.useExternalWorkerLauncher) {
externalWorkerLauncher = getExternalWorkerLauncher("hive", serverBinary, cacheMaxSize, remoteFunctionServerUds,
pluginDirectory, failOnNestedLoopJoin, coordinatorSidecarEnabled, builtInWorkerFunctionsEnabled, enableRuntimeMetricsCollection, enableSsdCache, implicitCastCharNToVarchar);
pluginDirectory, failOnNestedLoopJoin, coordinatorSidecarEnabled, builtInWorkerFunctionsEnabled, enableRuntimeMetricsCollection, enableSsdCache);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets leave the implicitCastCharNToVarchar flag. Since its used in Meta production and likely elsewhere it would be good to try in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please take another look @aditi-pandit? Thanks.

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.

3 participants