zzcclp commented on a change in pull request #1218:
URL: https://github.com/apache/kylin/pull/1218#discussion_r435741400



##########
File path: 
server-base/src/main/java/org/apache/kylin/rest/service/TableService.java
##########
@@ -105,6 +117,37 @@
     @Autowired
     private AclEvaluate aclEvaluate;
 
+    public TableSchemaUpdateChecker getSchemaUpdateChecker() {
+        return new TableSchemaUpdateChecker(getTableManager(), 
getCubeManager(), getDataModelManager());
+    }
+
+    public void checkTableCompatibility(String prj, TableDesc tableDesc) {
+        TableSchemaUpdateChecker.CheckResult result = 
getSchemaUpdateChecker().allowReload(tableDesc, prj);
+        result.raiseExceptionWhenInvalid();
+    }
+
+    public void checkHiveTableCompatibility(String prj, TableDesc tableDesc) 
throws Exception {
+        Preconditions.checkNotNull(tableDesc.getDatabase());
+        Preconditions.checkNotNull(tableDesc.getName());
+
+        String database = tableDesc.getDatabase().toUpperCase(Locale.ROOT);
+        String tableName = tableDesc.getName().toUpperCase(Locale.ROOT);
+        ProjectInstance projectInstance = getProjectManager().getProject(prj);
+        ISourceMetadataExplorer explr = 
SourceManager.getSource(projectInstance).getSourceMetadataExplorer();
+
+        TableDesc hiveTableDesc;
+        try {
+            Pair<TableDesc, TableExtDesc> pair = 
explr.loadTableMetadata(database, tableName, prj);
+            hiveTableDesc = pair.getFirst();
+        } catch (Exception e) {
+            logger.error("Fail to get metadata for hive table {} due to ", 
tableDesc.getIdentity(), e);
+            throw new RuntimeException("Fail to get metadata for hive table" + 
tableDesc.getIdentity());

Review comment:
       add one blank space before '" +'




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to