Copilot commented on code in PR #50562:
URL: https://github.com/apache/arrow/pull/50562#discussion_r3618077606


##########
cpp/src/arrow/flight/sql/odbc/tests/describe_col_test.cc:
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"
+
+#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include <gtest/gtest.h>
+
+namespace arrow::flight::sql::odbc {
+
+template <typename T>
+class DescribeColTest : public T {};
+
+class DescribeColMockTest : public FlightSQLODBCMockTestBase {};
+class DescribeColRemoteTest : public FlightSQLODBCRemoteTestBase {};
+using TestTypes = ::testing::Types<DescribeColMockTest, DescribeColRemoteTest>;

Review Comment:
   These typed tests include the mock server fixture, but the mock SQLite 
server reports SQL_WVARCHAR metadata for SELECT ... AS queries (see 
columns_test.cc::ColumnsMockTest::SQLDescribeColQueryAllDataTypesMetadata). As 
written, the DECIMAL/TIMESTAMP EXPECT_EQ checks (and the <100 column_size 
assertions) will fail under the mock fixture and won’t actually exercise the 
numeric/datetime branches in SQLDescribeCol.



##########
cpp/src/arrow/flight/sql/odbc/tests/describe_col_test.cc:
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"
+
+#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include <gtest/gtest.h>
+
+namespace arrow::flight::sql::odbc {
+
+template <typename T>
+class DescribeColTest : public T {};
+
+class DescribeColMockTest : public FlightSQLODBCMockTestBase {};
+class DescribeColRemoteTest : public FlightSQLODBCRemoteTestBase {};
+using TestTypes = ::testing::Types<DescribeColMockTest, DescribeColRemoteTest>;
+TYPED_TEST_SUITE(DescribeColTest, TestTypes);
+
+namespace {
+// Sentinel used to pre-fill the SQLULEN column_size output. If SQLDescribeCol
+// only writes the low bytes (the width bug this test guards against), the 
upper
+// bytes remain set to this pattern and the value is far outside any legal
+// column size.
+constexpr SQLULEN kColumnSizeSentinel = 
static_cast<SQLULEN>(0xFFFFFFFFFFFFFFFFULL);
+
+// Column ordinals in the all-data-types query (see
+// ODBCTestBase::GetQueryAllDataTypes). Decimal and timestamp exercise the
+// numeric-precision and datetime-precision code paths in SQLDescribeCol.
+constexpr SQLUSMALLINT kDecimalColumn = 17;
+constexpr SQLUSMALLINT kTimestampColumn = 31;
+}  // namespace
+
+// Verify that SQLDescribeCol fully initializes the SQLULEN column_size output
+// for a DECIMAL column. Prior to GH-50XXX the numeric path read
+// SQL_DESC_PRECISION (a SQLSMALLINT) straight into the SQLULEN* output, 
writing
+// only 2 of the 8 bytes and leaving the upper 6 bytes as uninitialized 
garbage.

Review Comment:
   The comment references "GH-50XXX"; this placeholder should be updated to the 
actual issue/PR number (GH-50560) so the breadcrumb remains accurate.



-- 
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]

Reply via email to