Skip to content

[fix](jdbc) Map SQL Server user-defined alias types via JDBC DATA_TYPE - #67903

Open
arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:fix/67793-sqlserver-alias-types
Open

[fix](jdbc) Map SQL Server user-defined alias types via JDBC DATA_TYPE#67903
arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:fix/67793-sqlserver-alias-types

Conversation

@arimu1

@arimu1 arimu1 commented Sep 13, 2026

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: close #67793

Related PR: N/A

Problem Summary:

SQL Server JDBC catalog schema discovery maps columns using JdbcSQLServerClient.jdbcTypeToDoris(), which only matched built-in TYPE_NAME values. User-defined alias types created with CREATE TYPE ... FROM varchar expose a custom TYPE_NAME (for example customtexttype) while DATA_TYPE remains Types.VARCHAR, so Doris mapped them to UNSUPPORTED and blocked queries.

Release note

Fixed JDBC SQL Server external catalog mapping for user-defined alias types when JDBC reports a standard scalar DATA_TYPE.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
  • Behavior changed:

    • No.
    • Yes. Unknown TYPE_NAME values now fall back to JDBC DATA_TYPE for standard scalar types (e.g. varchar aliases → STRING). CLR/special types still reported as unsupported binary codes remain unsupported.
  • Does this need documentation?

    • No.
    • Yes.

Test plan

  • cd fe && mvn test -pl fe-core -am -Dtest=JdbcSQLServerClientTest -Dsurefire.failIfNoSpecifiedTests=false -Ddoris.thrift.executable=/opt/homebrew/bin/thrift
  • JDK 17, Maven 3.9+

Fixes #67793

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

When mssql-jdbc reports a user-defined alias TYPE_NAME, fall back to
standard java.sql.Types codes so varchar-based aliases map to STRING
instead of UNSUPPORTED.
@arimu1
arimu1 force-pushed the fix/67793-sqlserver-alias-types branch 2 times, most recently from 99a9134 to 556c452 Compare September 13, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [JDBC Catalog] SQL Server user-defined alias data types map to UNSUPPORTED_TYPE

2 participants