Copilot commented on code in PR #50021:
URL: https://github.com/apache/arrow/pull/50021#discussion_r3700462255
##########
cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc:
##########
@@ -758,32 +751,18 @@ TYPED_TEST(ConnectionInfoTest, TestSQLGetInfoDropDomain) {
EXPECT_EQ(static_cast<SQLUINTEGER>(0), value);
}
-TYPED_TEST(ConnectionInfoHandleTest, TestSQLGetInfoDropSchema) {
- // GH-49482 TODO: resolve inconsitent return value for SQL_DROP_SCHEMA and
change test
- // type to `ConnectionInfoTest`
- this->ConnectWithString(this->GetConnectionString(), this->conn);
-
+TYPED_TEST(ConnectionInfoTest, TestSQLGetInfoDropSchema) {
SQLUINTEGER value;
GetInfo(this->conn, SQL_DROP_SCHEMA, &value);
- EXPECT_EQ(static_cast<SQLUINTEGER>(0), value);
-
- EXPECT_EQ(SQL_SUCCESS, SQLDisconnect(this->conn))
- << GetOdbcErrorMessage(SQL_HANDLE_DBC, this->conn);
+ EXPECT_EQ(static_cast<SQLUINTEGER>(SQL_DS_DROP_SCHEMA), value);
Review Comment:
`SQL_DROP_SCHEMA` is expected to be non-zero here, but the mock server used
by this typed suite is `SQLiteFlightSqlServer`, which advertises
`SqlInfoOptions::SQL_DDL_SCHEMA = false` (see
`cpp/src/arrow/flight/sql/example/sqlite_sql_info.cc:47-49`). With the updated
`GetInfoCache` logic, `SQL_DROP_SCHEMA` should therefore remain `0` for the
mock fixture.
If the remote fixture should return `SQL_DS_DROP_SCHEMA`, this test likely
needs to be split/conditioned per fixture type instead of asserting a single
value for both mock and remote.
##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/get_info_cache.cc:
##########
@@ -395,25 +399,21 @@ bool GetInfoCache::LoadInfoFromServer() {
// Unused by ODBC.
break;
case SqlInfoOptions::SQL_DDL_SCHEMA: {
- // GH-49500 TODO: use scalar bool to determine
`SQL_CREATE_SCHEMA` and
- // `SQL_DROP_SCHEMA` values
-
- // Note: this is a bitmask and we can't describe cascade or
restrict
- // flags.
- info_[SQL_DROP_SCHEMA] =
static_cast<uint32_t>(SQL_DS_DROP_SCHEMA);
-
- // Note: this is a bitmask and we can't describe authorization or
- // collation
- info_[SQL_CREATE_SCHEMA] =
static_cast<uint32_t>(SQL_CS_CREATE_SCHEMA);
+ bool supported =
+
checked_cast<BooleanScalar*>(scalar->child_value().get())->value;
+ info_[SQL_DROP_SCHEMA] =
+ static_cast<uint32_t>(supported ? SQL_DS_DROP_SCHEMA : 0);
+ info_[SQL_CREATE_SCHEMA] =
Review Comment:
With `SqlInfoOptions::SQL_DDL_SCHEMA = false` (as in the SQLite mock server:
`cpp/src/arrow/flight/sql/example/sqlite_sql_info.cc:47-49`), this code will
now correctly set both `SQL_DROP_SCHEMA` and `SQL_CREATE_SCHEMA` to `0`.
However, the test suite currently still has at least one schema-DDL-related
expectation that assumes schema DDL is supported (e.g.
`TestSQLGetInfoCreateSchema` / `TestSQLGetInfoDropSchema`).
Please update the affected expectations (or the mock server's advertised
capability, if intentional) so the tests match the server-reported
`SQL_DDL_SCHEMA` capability.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]