Skip to content

[Bug] Hive view queries fail due to case sensitivity issues in External Catalog #52557

@WeisonWei

Description

@WeisonWei

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.1.x, 3.0.x

What's Wrong?

When querying Hive views through External Catalog, queries fail due to case sensitivity issues. Hive view definitions often contain uppercase identifiers, but Doris processes them case-sensitively, causing table/column not found errors.

What You Expected?

Hive views should be queryable through Doris External Catalog regardless of the case used in the original view definition, maintaining compatibility with Hive's case-insensitive behavior.

How to Reproduce?

  1. Create a Hive view with uppercase identifiers:
-- In Hive
CREATE VIEW test_db.TEST_VIEW AS
SELECT COL1, COL2 FROM TEST_DB.TEST_TABLE WHERE COL1 = 'value';
  1. Configure Doris External Catalog:
-- In Doris
CREATE CATALOG hive_catalog PROPERTIES (
    "type"="hms",
    "hive.metastore.uris" = "thrift://hive-metastore:9083"
);
  1. Query the view through Doris:
-- This fails with table not found error
SELECT * FROM hive_catalog.test_db.TEST_VIEW;

Error:

ERROR 1105 (HY000): [ANALYSIS_ERROR]Unknown table 'TEST_TABLE' in database 'test_db'

Root Cause:
Hive stores view SQL with uppercase identifiers, but Doris processes them case-sensitively, causing table lookup failures.

Expected Fix:
The view should work after normalizing identifiers to lowercase while preserving quoted strings.

Anything Else?

Impact:

  • Affects users migrating from Hive to Doris
  • Breaks compatibility with existing Hive view definitions
  • Inconsistent behavior between direct table access and view access

Workaround:
Currently, users need to recreate Hive views with lowercase identifiers, which is not always feasible in production environments.

Related Components:

  • External Catalog (HMS)
  • Nereids Query Planner
  • View Processing

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions