You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "wuchong (via GitHub)" <gi...@apache.org> on 2023/04/23 08:06:35 UTC

[GitHub] [flink] wuchong commented on a diff in pull request #22166: [FLINK-31409][hive] Hive dialect should use public interfaces

wuchong commented on code in PR #22166:
URL: https://github.com/apache/flink/pull/22166#discussion_r1174528650


##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserDMLHelper.java:
##########
@@ -331,20 +333,48 @@ public Operation createInsertOperation(HiveParserCalcitePlanner analyzer, RelNod
                 createInsertOperationInfo(
                         queryRelNode,
                         destTable,
-                        HiveParserBaseSemanticAnalyzer.parseCompoundName(catalogManager, tableName),
+                        HiveParserBaseSemanticAnalyzer.parseCompoundName(
+                                catalogRegistry, tableName),
                         staticPartSpec,
                         analyzer.getDestSchemaForClause(insClauseName),
                         overwrite);
 
         return new SinkModifyOperation(
-                catalogManager.getTableOrError(insertOperationInfo.f0),
+                getContextResolvedTable(insertOperationInfo.f0),
                 insertOperationInfo.f1,
                 insertOperationInfo.f2,
                 null, // targetColumns
                 insertOperationInfo.f3,
                 Collections.emptyMap());
     }
 
+    private ContextResolvedTable getContextResolvedTable(ObjectIdentifier tableIdentifier) {

Review Comment:
   It seems we still need to depend on `ContextResolvedTable`, which is an `@Internal` class. The `getContextResolvedTable` method is somehow duplicated with `CatalogManager#getTable`. Besides, I don't favor the verbose method signature of `CatalogRegistry#getResolvedCatalogBaseTable`. What do you think about replacing the `CatalogRegistry#getResolvedCatalogBaseTable` with `CatalogRegistry#getTableOrError`? This can also make the callers easier without dealing with the empty result. 



##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserFactory.java:
##########
@@ -47,15 +47,6 @@ public Set<ConfigOption<?>> optionalOptions() {
 
     @Override
     public Parser create(Context context) {
-        return new HiveParser(
-                context.getCatalogManager(),
-                context.getPlannerContext()::createFlinkPlanner,
-                context.getPlannerContext()::createCalciteParser,
-                context.getPlannerContext());
-    }
-
-    @Override
-    public ExtendedOperationExecutor createExtendedOperationExecutor(Context context) {
-        return new HiveOperationExecutor(context.getCatalogManager(), context.getPlannerContext());
+        return new HiveParser((CalciteContext) context);

Review Comment:
   Please add a comment about the hard cast. 



-- 
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: issues-unsubscribe@flink.apache.org

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