SQLColumns Implementation - #66
Conversation
Co-Authored-By: rscales <5289449+rscales@users.noreply.github.com>
mock server doesn't support schema
Remove unneeded code
|
|
||
| add_arrow_test(flight_sql_odbc_test | ||
| SOURCES | ||
| columns_test.cc |
There was a problem hiding this comment.
SQLColumns is one of the functions that behaves differently in ODBC 2.x vs. ODBC 3.x and up. The SQL type it returns for datetime types changes depending on whether you're using ODBC 2 or 3. For example SQL_TIME=11 vs. SQL_TYPE_TIME=91 (or something similar to this).
Also the column names differ in 2 vs. 3:
TABLE_QUALIFIER in 2 and TABLE_CAT in 3.
This is also the case for SQLTables.
Please add a test for ODBC 2.x
There was a problem hiding this comment.
For the column names difference, we will add a test as part of SQLDescribeCol implementation in milestone 3. Yes the ODBC2 vs. 3 is pretty important, I remember the macOS Excel (which uses ODBC2) breaking and not getting database names because a driver I worked on before was returning TABLE_CAT as column name.
There was a problem hiding this comment.
Will look for a way to test time types with remote server
There was a problem hiding this comment.
Found the diff on odbc 2 and odbc 3:
- ODBC ver 3 returns SQL_TYPE_DATE, SQL_TYPE_TIME, and SQL_TYPE_TIMESTAMP in the DATA_TYPE field
- ODBC ver 2 returns SQL_DATE, SQL_TIME, and SQL_TIMESTAMP in the DATA_TYPE field
Ref: https://learn.microsoft.com/en-us/sql/odbc/reference/appendixes/datetime-data-types?view=sql-server-ver17
There was a problem hiding this comment.
I have added the test for different data type return value for SQLColumns, and added todo comment for SQLDescribeCol tests
| #include "gtest/gtest.h" | ||
|
|
||
| namespace arrow::flight::sql::odbc { | ||
| void checkSQLColumns( |
There was a problem hiding this comment.
We need to validate the metadata of the SQLColumns result itself too (ie run SQLDescribeCol and check the column names, the number of columns, types for each column, etc). This needs to be done at least once for each of ODBC 2 and 3.
This applies to other catalog functions.
There was a problem hiding this comment.
Sure, we can add the tests for this as part of SQLDescribeCol implementation, SQLDescribeCol is scheduled in milestone 3 so we can add the metadata tests for SQLColumns and SQLTables in milestone 3. (Btw SQLPrimaryKeys and SQLForeignKeys were not implemented in the flightsql-odbc in the apache arrow repo https://github.com/apache/arrow, so would be out of scope for us to implement)
- Test different data type return value for SQLColumns - Add todo comment for SQLDescribeCol tests
No description provided.