liujiwen-up commented on code in PR #46308:
URL: https://github.com/apache/doris/pull/46308#discussion_r1914826586


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java:
##########
@@ -446,9 +450,43 @@ public BaseAnalysisTask createAnalysisTask(AnalysisInfo 
info) {
     public String getViewText() {
         String viewText = getViewExpandedText();
         if (StringUtils.isNotEmpty(viewText)) {
-            return viewText;
+            if (!viewText.equals("/* Presto View */")) {
+                return viewText;
+            }
+        }
+
+        String originalText = getViewOriginalText();
+        /**
+         * Get the SQL text definition of the view.
+         * For Presto views, the definition is stored in the format:
+         * View Original Text: /* Presto View: <base64-encoded-json> * /
+         *
+         * The base64 encoded JSON contains the following fields:
+         * {
+         *   "originalSql": "SELECT * FROM employees",  // The original SQL 
statement
+         *   "catalog": "hive",                               // The data 
catalog name
+         *   "schema": "mmc_hive",                           // The schema name
+         *    .....
+         * }
+         */
+        if (originalText != null && originalText.contains("/* Presto View: ")) 
{

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java:
##########
@@ -446,9 +450,52 @@ public BaseAnalysisTask createAnalysisTask(AnalysisInfo 
info) {
     public String getViewText() {
         String viewText = getViewExpandedText();
         if (StringUtils.isNotEmpty(viewText)) {
-            return viewText;
+            if (!viewText.equals("/* Presto View */")) {
+                return viewText;
+            }
+        }
+
+        String originalText = getViewOriginalText();
+        String trinoViewSql = parseTrinoViewDefinition(originalText);
+        return trinoViewSql != null ? trinoViewSql : originalText;

Review Comment:
   done



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to