morningman commented on code in PR #46308:
URL: https://github.com/apache/doris/pull/46308#discussion_r1904849153
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindRelation.java:
##########
@@ -520,4 +531,29 @@ private List<Long> getPartitionIds(TableIf t,
UnboundRelation unboundRelation, L
return part.getId();
}).collect(ImmutableList.toImmutableList());
}
+
+ /**
+ * Convert view definition SQL based on current SQL dialect
+ */
+ private String convertViewDefinition(String originSql, ConnectContext ctx)
{
Review Comment:
I suggest the extract a common method to do the conversion.
This code is just same as in `convertOriginStmt()` in `ConnectProcessor.java`
##########
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:
Extract this logic to a separate method, like `parseTrinoViewXXX()`, to make
the code more clear
--
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]