Skip to content

Conversation

@alinaliBQ
Copy link
Contributor

@alinaliBQ alinaliBQ commented Nov 4, 2025

Rationale for this change

Implement ODBC to return column attribute values from the result set

What changes are included in this PR?

  • SQLColAttribute & Tests

Are these changes tested?

Tested on local MSVC

Are there any user-facing changes?

N/A

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

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

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Nov 4, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47721-sql-col-attribute branch from 44deffe to f3e267e Compare November 10, 2025 18:52
@alinaliBQ alinaliBQ changed the title GH-47721: [C++][FlightRPC] WIP: Return ODBC Column Attribute from result set GH-47721: [C++][FlightRPC] Return ODBC Column Attribute from result set Nov 10, 2025
@alinaliBQ
Copy link
Contributor Author

@lidavidm Draft PR is ready for review 🙂

@lidavidm
Copy link
Member

@alinaliBQ sorry but do you mind just undrafting PRs when they are ready? That way it pings me automatically and if I approve, I can merge directly

return true;
default:
return false;
return true;
Copy link
Member

Choose a reason for hiding this comment

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

Won't this give a bad result on non-numeric types? (Maybe the right answer is to throw?)

Copy link
Member

Choose a reason for hiding this comment

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

In any case, there's is_unsigned_integer in type_traits.h...I don't see why listing out the signed types explicitly here makes any difference if you aren't going to throw for non-numeric types

Copy link
Contributor

Choose a reason for hiding this comment

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

Now using arrow::is_unsigned_integer() instead.
We don't want to throw an exception for non-numeric types because we expect all the columns of a result set to hit this logic regardless of type. Returning false for non-numerics is the desired behavior.

}

std::string FlightSqlResultSetMetadata::GetTypeName(int column_position) {
std::string FlightSqlResultSetMetadata::GetTypeName(int column_position, int data_type) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a more precise type we can use than int?

Copy link
Contributor

Choose a reason for hiding this comment

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

Now using int16_t.

Comment on lines +154 to +160
void CheckSQLColAttributes(SQLHSTMT stmt, SQLUSMALLINT idx,
const std::wstring& expected_column_name,
SQLLEN expected_data_type, SQLLEN expected_display_size,
SQLLEN expected_prec_scale, SQLLEN expected_length,
SQLLEN expected_column_size, SQLLEN expected_column_scale,
SQLLEN expected_column_nullability, SQLLEN expected_searchable,
SQLLEN expected_unsigned_column) {
Copy link
Member

Choose a reason for hiding this comment

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

Is the difference just which attributes are checked? Is there any better way to name this? Otherwise I think they should just be overloads of the same function

Copy link
Contributor

Choose a reason for hiding this comment

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

No this is testing a different ODBC API. The earlier function was testing SQLColAttribute (singular attribute) while this one is testing SQLColAttributes (plural attributes). Understandably this difference is very easy to miss.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 11, 2025
@alinaliBQ
Copy link
Contributor Author

alinaliBQ commented Nov 12, 2025

@alinaliBQ sorry but do you mind just undrafting PRs when they are ready? That way it pings me automatically and if I approve, I can merge directly

Hi @lidavidm I was out of office yesterday, will reply to your comment on #46099 (comment). Please see my reply in #46099 (comment)

@justing-bq justing-bq force-pushed the gh-47721-sql-col-attribute branch from 4395e8a to d46ee0c Compare November 13, 2025 20:27
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 13, 2025
@justing-bq
Copy link
Contributor

@lidavidm Please take another look.

Co-Authored-By: justing-bq <[email protected]>
Co-Authored-By: alinalibq <[email protected]>
@justing-bq justing-bq force-pushed the gh-47721-sql-col-attribute branch from d46ee0c to e2a3362 Compare November 17, 2025 23:18
@alinaliBQ alinaliBQ marked this pull request as ready for review November 18, 2025 17:45
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