WeisonWei opened a new issue, #52557:
URL: https://github.com/apache/doris/issues/52557

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) 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:**
   ```sql
   -- In Hive
   CREATE VIEW test_db.TEST_VIEW AS
   SELECT COL1, COL2 FROM TEST_DB.TEST_TABLE WHERE COL1 = 'value';
   ```
   
   2. **Configure Doris External Catalog:**
   ```sql
   -- In Doris
   CREATE CATALOG hive_catalog PROPERTIES (
       "type"="hms",
       "hive.metastore.uris" = "thrift://hive-metastore:9083"
   );
   ```
   
   3. **Query the view through Doris:**
   ```sql
   -- 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?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to