Skip to content

Conversation

@justing-bq
Copy link
Contributor

@justing-bq justing-bq commented Oct 10, 2025

Rationale for this change

#47786

What changes are included in this PR?

Created a new directory/subproject for tests.
Added a testing utility class called odbc_test_suite.
Created new test file with one simple test.

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions
Copy link

⚠️ GitHub issue #47786 has been automatically assigned in GitHub to PR creator.

Comment on lines 401 to 417
// TODO: once RegisterDsn is implemented in Mac and Linux, the following can be
// re-enabled.
#if defined _WIN32 || defined _WIN64
bool WriteDSN(std::string connection_str) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please raise a GitHub issue for this todo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Oct 10, 2025
@justing-bq justing-bq marked this pull request as ready for review October 14, 2025 18:01
@justing-bq justing-bq requested a review from lidavidm as a code owner October 14, 2025 18:01

void FlightSQLODBCRemoteTestBase::SetUp() {
if (arrow::internal::GetEnvVar(TEST_CONNECT_STR).ValueOr("").empty()) {
GTEST_SKIP() << "Skipping FlightSQLODBCRemoteTestBase test: TEST_CONNECT_STR not set";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change to use arrow log for this?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Oct 16, 2025
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 16, 2025
Copy link
Contributor

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

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

LGTM

@justing-bq justing-bq requested a review from lidavidm October 17, 2025 23:07
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 19, 2025
@justing-bq justing-bq requested a review from lidavidm October 20, 2025 20:02
Comment on lines 143 to 151
template <typename T>
class FlightSQLODBCTestBase : public T {
public:
using List = std::list<T>;
};

using TestTypes =
::testing::Types<FlightSQLODBCMockTestBase, FlightSQLODBCRemoteTestBase>;
TYPED_TEST_SUITE(FlightSQLODBCTestBase, TestTypes);
Copy link
Member

Choose a reason for hiding this comment

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

Why is the parametrization so complex here? Subclassing a type parameter looks suspicious...Is the idea to test with a mocked server and an in process server?

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in the other PR I would prefer we don't scatter tests using this fixture across different files. So instead of having FlightSQLODBCTestBase defined here I would rather we have proper docstrings for FlightSQLODBCMockTestBase and FlightSQLODBCRemoteTestBase that explain what they're for and how you're expected to parametrize them, and define the equivalent of FlightSQLODBCTestBase in individual test files where necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

For parametrization, we followed Google's instruction for creating typed tests (https://google.github.io/googletest/advanced.html#typed-tests), and their example used using List = std::list<T>; etc.

Is the idea to test with a mocked server and an in process server?

Yes that is right. For majority of ODBC tests, we want to run the tests on both a local mock server and a remote server. I agree that FlightSQLODBCTestBase can be removed cc @justing-bq.

Copy link
Member

@lidavidm lidavidm Oct 20, 2025

Choose a reason for hiding this comment

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

their example used using List = std::list<T>

Um, but do you need to use that? If not, please remove it. It's not required.

Note the justification for typed tests:

Suppose you have multiple implementations of the same interface and want to make sure that all of them satisfy some common requirements. Or, you may have defined several types that are supposed to conform to the same “concept” and you want to verify it. In both cases, you want the same test logic repeated for different types.

While it's not like you can't use the mechanism in other ways, it's a little surprising to see it used in this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FlightSQLODBCTestBase is now removed. Future PRs will be adding separate equivalent text fixtures for each file.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting merge Awaiting merge labels Oct 20, 2025
};

/** ODBC read buffer size. */
constexpr int ODBC_BUFFER_SIZE = 1024;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
constexpr int ODBC_BUFFER_SIZE = 1024;
static constexpr int kOdbcBufferSize = 1024;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 39 to 40
#define TEST_CONNECT_STR "ARROW_FLIGHT_SQL_ODBC_CONN"
#define TEST_DSN "Apache Arrow Flight SQL Test DSN"
Copy link
Member

Choose a reason for hiding this comment

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

While we're at it, these could be static constexpr std::string_view (maybe that's inconvenient though)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 22, 2025
Co-Authored-By: rscales <[email protected]>
Co-Authored-By: justing-bq <[email protected]>
Co-Authored-By: alinalibq <[email protected]>
@lidavidm lidavidm merged commit 0a0ee3e into apache:main Oct 22, 2025
44 of 46 checks passed
@lidavidm lidavidm removed the awaiting merge Awaiting merge label Oct 22, 2025
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 0a0ee3e.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants