Skip to content

GH-47786: [C++][FlightRPC] Establish ODBC tests - #47788

Merged
lidavidm merged 1 commit into
apache:mainfrom
Bit-Quill:startTest
Oct 22, 2025
Merged

lidavidm merged 1 commit into
apache:mainfrom
Bit-Quill:startTest

Conversation

@justing-bq

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

Comment on lines +401 to +404
// 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
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


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

Copy link
Copy Markdown
Collaborator

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?

@alinaliBQ alinaliBQ left a comment

Copy link
Copy Markdown
Collaborator

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
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

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.

@lidavidm lidavidm Oct 20, 2025 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

};

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Co-Authored-By: rscales <robscales@icloud.com>
Co-Authored-By: justing-bq <justin.gossett@improving.com>
Co-Authored-By: alinalibq <alina.li@improving.com>
@conbench-apache-arrow

Copy link
Copy Markdown

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.

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Nov 5, 2025
### Rationale for this change
apache#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 Issue: apache#47786

Authored-by: justing-bq <62349012+justing-bq@users.noreply.github.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
@justing-bq
justing-bq deleted the startTest branch January 27, 2026 21:21
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
apache#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 Issue: apache#47786

Authored-by: justing-bq <62349012+justing-bq@users.noreply.github.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
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