Skip to content

[native] Introduce module presto-native-tests#24234

Merged
pramodsatya merged 2 commits intoprestodb:masterfrom
pramodsatya:add_native_tests
Mar 26, 2025
Merged

[native] Introduce module presto-native-tests#24234
pramodsatya merged 2 commits intoprestodb:masterfrom
pramodsatya:add_native_tests

Conversation

@pramodsatya
Copy link
Contributor

@pramodsatya pramodsatya commented Dec 10, 2024

Description

Introduces module presto-native-tests to run end-to-end tests with Presto native workers. Adds Github action to run these tests.

Motivation and Context

Improves Presto native test coverage by extending product tests from presto-tests module to use the native worker. For full context please refer to #23671.

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
== RELEASE NOTES ==
General Changes
* Introduces module presto-native-tests to run end-to-end tests with Presto native workers. 

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Dec 10, 2024
@prestodb-ci prestodb-ci requested review from a team and ScrapCodes and removed request for a team December 10, 2024 15:25
@pramodsatya pramodsatya force-pushed the add_native_tests branch 2 times, most recently from 6f3ef6f to ceeabce Compare December 15, 2024 06:31
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thank you for the documentation! I made some suggestions for ease of reading and clarity.

If you feel that any of my suggestions change the meaning in a way that is not correct, let me know and we can work on them together.

Copy link
Contributor Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback @steveburnett, addressed the comments, could you please take another look?

steveburnett
steveburnett previously approved these changes Jan 14, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for addressing the comments! Looks good.

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@pramodsatya : Lets move the second commit to refactor presto-tests in a separate PR. That would make it easier to review. Lets add this work as a motivation for that refactoring.

protected QueryRunner createQueryRunner() throws Exception
{
return PrestoNativeQueryRunnerUtils.createNativeQueryRunner(
ImmutableMap.of("experimental.iterative-optimizer-enabled", "false"),
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this do ? Its important to specify why this test configuration matters.

}

@Override
protected void createTables()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this function be moved to AbstractTestQueriesNative ?

assertQuery("select reduce_agg(x, array[], (x, y)->array[element_at(x, 2)], (x, y)->array[element_at(x, 2)]) from (select array[array[1]]) T(x)", "select array[null]");
}

// The following approx_set function tests are overriden since approx_set returns different results in Presto C++.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any outward article or documentation for this ? If not, then we should write one.

@Test
public void testArrayCumSumDecimals()
{
String functionNotRegisteredError = ".*Scalar function presto.default.array_cum_sum not registered with arguments.*";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have this error because we don't have this functionality ? I don't see a reason for not building it. Do we have an issue for this ? Please create one if its not there and add the link here.


@Override
@Test
public void testDuplicateUnnestRows()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have an issue for this ?


@Override
@Test
public void testSamplingJoinChain()
Copy link
Contributor

Choose a reason for hiding this comment

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

key_sampling seems like an important feature. Do we have an issue ?


@Override
@Test
public void testScalarSubquery()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this test separated from the java one ?


@Override
@Test
public void testLikePrefixAndSuffixWithChars()
Copy link
Contributor

Choose a reason for hiding this comment

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

These failures are because CHAR Is not supported. Lets add the issue here.

But also any reason these are written with CHAR and not VARCHAR ? We could try to split the original test.

}

@Override
public void testMergeKHyperLogLog()
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an issue for the type not supported and link it here.

Copy link
Contributor Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks @aditi-pandit, addressed the comments and created missing issues. Also modified this PR to only include test classes with fewer modifications as discussed. Will open follow-up PRs for the remaining larger test classes from #23671, such as AbstractTestQueriesNative.java.
Could you please take another look?

@pramodsatya pramodsatya force-pushed the add_native_tests branch 2 times, most recently from bdd1b9f to 7e62480 Compare January 23, 2025 03:59
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya

private static final String storageFormat = "PARQUET";

@Override
protected QueryRunner createQueryRunner() throws Exception
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we plan to overload the expected query runner with the JavaQueryRunner as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we do not plan to overload the expected query runner with javaQueryRunner because it does not account for the datatypes of the computed result when comparing it with the expected values. This limitation is noted here.

@Override
protected QueryRunner createQueryRunner() throws Exception
{
return PrestoNativeQueryRunnerUtils.createNativeQueryRunner(
Copy link
Contributor

Choose a reason for hiding this comment

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

Does native engine support these session properties ? Will native side-car catch these ?

Copy link
Contributor Author

@pramodsatya pramodsatya Jan 24, 2025

Choose a reason for hiding this comment

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

Thanks for pointing it out, the property experimental.optimized-repartitioning is not applicable to the native engine so removed it. Native engine does support driver.max-page-partitioning-buffer-size, which is required for this test, so retained this config.
The native sidecar currently does not throw an error if a session property is set that is not supported by native engine, this is to support heterogeneous environments. The sidecar is enabled now.

@pramodsatya pramodsatya force-pushed the add_native_tests branch 2 times, most recently from b8c41e4 to 2b7da84 Compare January 24, 2025 00:47
@pramodsatya pramodsatya force-pushed the add_native_tests branch 2 times, most recently from a6b9b90 to f7e6ff8 Compare January 28, 2025 00:20
assertQuery(chicago, "SELECT DATE '2013-03-22'");
assertQuery(kathmandu, "SELECT DATE '2013-03-22'");

assertQueryFails("SELECT TIME '3:04:05'", timeTypeUnsupportedError);
Copy link
Contributor

@aditi-pandit aditi-pandit Feb 27, 2025

Choose a reason for hiding this comment

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

@pramodsatya : These are constants and should be evaluated in the co-ordinator. Any more insight into why they failed ? Is it because of side-car ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aditi-pandit, apologies for the delay. Not sure why this is not evaluated in the coordinator but it is not because of the sidecar. Here is the output of explain:

presto> explain SELECT TIME '3:04:05';
                                                     Query Plan
--------------------------------------------------------------------------------------------------------------------
 - Output[PlanNodeId 5][_col0] => [expr:time]
         Estimates: {source: CostBasedSourceInfo, rows: 1 (9B), cpu: 9.00, memory: 0.00, network: 0.00}
         _col0 := expr (1:16)
     - Project[PlanNodeId 1][projectLocality = LOCAL] => [expr:time]
             Estimates: {source: CostBasedSourceInfo, rows: 1 (9B), cpu: 9.00, memory: 0.00, network: 0.00}
             expr := TIME'03:04:05.000'
         - LocalExchange[PlanNodeId 168][ROUND_ROBIN] () => []
                 Estimates: {source: CostBasedSourceInfo, rows: 1 (9B), cpu: 0.00, memory: 0.00, network: 0.00}
             - Values[PlanNodeId 0] => []
                     Estimates: {source: CostBasedSourceInfo, rows: 1 (9B), cpu: 0.00, memory: 0.00, network: 0.00}
                     ()

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@pramodsatya : This PR is looking very close to complete.

@czentgr : Please can you take a look at the yml and pom files.

@steveburnett
Copy link
Contributor

Please remove the manual PR link in the following format from the release note entries for this PR.


:pr:`12345`

I have updated the Release Notes Guidelines to remove the examples of manually adding the PR link.

== RELEASE NOTES ==
General Changes
* Introduces module presto-native-tests to run end-to-end tests with Presto native workers. 

@aditi-pandit
Copy link
Contributor

@amitkdutta @jaystarshot : This PR is the first version of presto-native-tests. This is the suite to run all Java presto-product-tests with the native engine.

Would be great to get your reviews for this PR.

pramodsatya and others added 2 commits March 20, 2025 15:37
Co-authored-by: Manoj Negi <manojneg@in.ibm.com>
Co-authored-by: Manoj Negi <manojneg@in.ibm.com>
@aditi-pandit
Copy link
Contributor

@majetideepak @czentgr : Please can you both take a look at this PR. It would be great to add the presto-native-tests module to the build.

@jaystarshot
Copy link
Member

jaystarshot commented Mar 24, 2025

Refactor testcases for presto-native-tests

commit is unrelated here?

@pramodsatya
Copy link
Contributor Author

Refactor testcases for presto-native-tests

commit is unrelated here?

@jaystarshot, this commit splits the testcases from presto-tests based on what is supported by the Prestissimo. It is not necessary here but it would help run more Sql queries from these testcases with the native worker.
For instance, testOrderByWithOutputColumnReference in AbstractTestOrderByQueries has three queries involving lambdas that would fail in Prestissimo (since apply function is not supported). Moving these to a separate testcase, testOrderByWithOutputColumnReferenceInLambdas, lets us just disable this testcase and run the remaining ~35 queries from testOrderByWithOutputColumnReference in presto-native-tests.
Is it fine if this commit is retained?

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya

-Duser.timezone=America/Bahia_Banderas \
-T1C

prestocpp-linux-presto-native-tests:
Copy link
Contributor

Choose a reason for hiding this comment

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

Too much code copying is happening with these test jobs (E22, sidecar plugin and now this one). We will refactor the test jobs after the merge and not make the refactor part of the PR.

@pramodsatya pramodsatya merged commit d840d84 into prestodb:master Mar 26, 2025
99 checks passed
@pramodsatya pramodsatya deleted the add_native_tests branch March 26, 2025 14:51
@prestodb-ci prestodb-ci mentioned this pull request Mar 28, 2025
30 tasks
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.

6 participants