test(native): Add AbstractTestQueries to native tests#23671
test(native): Add AbstractTestQueries to native tests#23671pramodsatya wants to merge 2 commits intomasterfrom
AbstractTestQueries to native tests#23671Conversation
steveburnett
left a comment
There was a problem hiding this comment.
LGTM! (docs)
Reviewed README.md, no concerns. Thanks for the doc!
acaa071 to
8ec8208
Compare
|
Are these tests being run as part of the CI? |
|
They are not being run as part of CI currently, but we plan to setup a pipeline to run these tests on a regular cadence subsequently. Will also add a CI job to run these tests in a follow-up PR. |
presto-native-tests/src/test/java/com.facebook.presto.nativetests/TestAggregations.java
Outdated
Show resolved
Hide resolved
32b2ad6 to
f614cb6
Compare
11d653c to
47ecc65
Compare
|
Just a suggestions for the release note: Consider using the description of the PR in the release note entry to help a release note reader understand what this module does. |
Thanks for the suggestion @steveburnett, updated accordingly. |
## Description Fixes expected `orderdate` length in `testShowColumns` for `DWRF` file format. ## Motivation and Context Required by tests to be added in #23671 . ``` == NO RELEASE NOTE == ```
94746ea to
e8b547d
Compare
|
@aditi-pandit, could you please help review this PR? I addressed the previous review comments and opened issues for failures identified. |
...to-native-tests/src/test/java/com/facebook/presto/nativetests/AbstractTestQueriesNative.java
Fixed
Show fixed
Hide fixed
e8b547d to
020e735
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for running testcases from AbstractTestQueries with the C++ worker in presto-native-tests. This significantly improves Presto C++ end-to-end test coverage by extending production tests from the presto-tests module to use the native worker.
Key changes:
- Added two new test classes (
TestTpchDistributedQueriesandTestNonIterativeDistributedQueries) that run tests with different optimizer configurations - Created
AbstractTestQueriesNativeas a base class that extendsAbstractTestQuerieswith C++-specific test overrides and error handling - Updated table creation utilities to support TPC-H standard schema for better test compatibility
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
presto-native-tests/src/test/java/com/facebook/presto/nativetests/AbstractTestQueriesNative.java |
New abstract base class that extends AbstractTestQueries with C++-specific test overrides and error message patterns |
presto-native-tests/src/test/java/com/facebook/presto/nativetests/TestTpchDistributedQueries.java |
New test class running testcases with default native hive query runner using PARQUET storage format |
presto-native-tests/src/test/java/com/facebook/presto/nativetests/TestNonIterativeDistributedQueries.java |
New test class running testcases with iterative optimizer disabled using DWRF storage format |
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java |
Modified queries to add ORDER BY clause and simplified regex patterns for better C++ compatibility |
presto-native-tests/src/test/java/com/facebook/presto/nativetests/NativeTestsUtils.java |
Updated createTables calls to use new parameter for TPC-H standard schema |
presto-native-tests/presto_cpp/tests/custom_functions/CustomFunctions.cpp |
Registered custom_add function for native testing |
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java |
Added useTpchStandardSchema parameter to table creation methods for flexibility in test schema configuration |
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeIcebergTpchQueries.java |
Updated to use new createLineitemStandard signature with castDateToVarchar parameter |
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeHiveExternalTableTpchQueries.java |
Updated to use new createLineitemStandard signature with castDateToVarchar parameter |
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeCteExecution.java |
Updated to use new createAllTables signature with useTpchStandardSchema parameter |
presto-docs/src/main/sphinx/presto_cpp/limitations.rst |
Added documentation for approx_set function differences between Presto C++ and Presto Java |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...to-native-tests/src/test/java/com/facebook/presto/nativetests/AbstractTestQueriesNative.java
Outdated
Show resolved
Hide resolved
...o-native-tests/src/test/java/com/facebook/presto/nativetests/TestTpchDistributedQueries.java
Show resolved
Hide resolved
...-tests/src/test/java/com/facebook/presto/nativetests/TestNonIterativeDistributedQueries.java
Show resolved
Hide resolved
...-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java
Outdated
Show resolved
Hide resolved
020e735 to
4770a1b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Test | ||
| public void testAnalyzePropertiesSystemTable() | ||
| { | ||
| assertQuery("SELECT COUNT(*) FROM system.metadata.analyze_properties WHERE catalog_name = 'tpch'", "SELECT 0"); |
There was a problem hiding this comment.
@aditi-pandit, this does not fail on native, it is added here to maintain consistency with the TestTpchDistributedQueries from presto-tests:
Ideally the tests here should be moved to a separate abstract class, I can take this up in a subsequent PR?
There was a problem hiding this comment.
Yeah... you can move the tests to a separate abstract class. Lets avoid rewriting the tests.
There was a problem hiding this comment.
I tried moving these tests out of TestTpchDistributedQueries and into an abstract class, but because we are overriding several tests from the base class AbstractTestQueries for native testing, this refactor does not help avoid rewriting the tests.
Could I add a TODO comment for this?
aditi-pandit
left a comment
There was a problem hiding this comment.
@pramodsatya : Another high level comment: Whether we cast Date depends on the storage format as DWRF doesn't support DATE but Parquet does. Ideally we should use that to guide the casting and avoid the extra parameter as much as possible. Lets cleanup guided by that.
...st/java/com/facebook/presto/nativeworker/AbstractTestNativeHiveExternalTableTpchQueries.java
Outdated
Show resolved
Hide resolved
...ion/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeIcebergTpchQueries.java
Outdated
Show resolved
Hide resolved
| assertQuery(session, "select o.custkey, c.name from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select o.orderkey, c.name from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select *, cast(o.custkey as varchar), cast(c.custkey as varchar) from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select c.name, cast(o.custkey as varchar), cast(c.custkey as varchar) from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); |
There was a problem hiding this comment.
Don't follow why these columns are added. Why did * not work ?
There was a problem hiding this comment.
The market segment and comment columns in customer table are swapped when select * is used (this happens without the config being tested here as well).
| @Test | ||
| public void testAnalyzePropertiesSystemTable() | ||
| { | ||
| assertQuery("SELECT COUNT(*) FROM system.metadata.analyze_properties WHERE catalog_name = 'tpch'", "SELECT 0"); |
There was a problem hiding this comment.
Yeah... you can move the tests to a separate abstract class. Lets avoid rewriting the tests.
...to-native-tests/src/test/java/com/facebook/presto/nativetests/AbstractTestQueriesNative.java
Outdated
Show resolved
Hide resolved
| assertQueryFails("SELECT greatest(rgb(255, 0, 0))", errorMessage); | ||
| } | ||
|
|
||
| /// The output JSON formatted string is different in Presto C++. |
There was a problem hiding this comment.
@amitkdutta : Can you review these tests for json_format usage ?
a949c4a to
8ab36e6
Compare
pramodsatya
left a comment
There was a problem hiding this comment.
Thanks @aditi-pandit, I have reverted the castDateToVarchar parameter to use storageFormat instead, and separated this change to #26955.
Could you please take another look?
...st/java/com/facebook/presto/nativeworker/AbstractTestNativeHiveExternalTableTpchQueries.java
Outdated
Show resolved
Hide resolved
...ion/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeIcebergTpchQueries.java
Outdated
Show resolved
Hide resolved
| @Test | ||
| public void testAnalyzePropertiesSystemTable() | ||
| { | ||
| assertQuery("SELECT COUNT(*) FROM system.metadata.analyze_properties WHERE catalog_name = 'tpch'", "SELECT 0"); |
There was a problem hiding this comment.
I tried moving these tests out of TestTpchDistributedQueries and into an abstract class, but because we are overriding several tests from the base class AbstractTestQueries for native testing, this refactor does not help avoid rewriting the tests.
Could I add a TODO comment for this?
| assertQuery(session, "select o.custkey, c.name from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select o.orderkey, c.name from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select *, cast(o.custkey as varchar), cast(c.custkey as varchar) from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); | ||
| assertQuery(session, "select c.name, cast(o.custkey as varchar), cast(c.custkey as varchar) from orders o join customer c on cast(o.custkey as varchar) = cast(c.custkey as varchar)"); |
There was a problem hiding this comment.
The market segment and comment columns in customer table are swapped when select * is used (this happens without the config being tested here as well).
8ab36e6 to
4115820
Compare
…on storageFormat (#26955) ## Description Reverts parameter `castDateToVarchar` in helper methods used to create Tpch tables for testing. Passes in the `storageFormat` instead, and modifies the `createTable` methods to use the storage format to decide if `Date` columns should be cast to `Varchar`. ## Motivation and Context Cleanup test utility methods for `presto-native-tests`: #23671. ## Impact NA. ## Test Plan Verified with existing native e2e tests. ``` == NO RELEASE NOTE == ```
4115820 to
d3c892a
Compare
|
Consider rebasing the PR to rerun the tests. |
|
@aditi-pandit, @czentgr, could you please help review these tests? |
Description
Adds support to run testcases from
AbstractTestQuerieswith the C++ worker inpresto-native-tests. These testcases are run with Presto's iterative optimizer disabled inTestNonIterativeDistributedQueriesand with the default native hive query runner inTestTpchDistributedQueries.Motivation and Context
Improves Presto C++ e2e test coverage with sidecar by extending production tests from
presto-testsmodule to use the native worker.Release Notes