miklosgergely commented on a change in pull request #969: HIVE-23123 Disable 
export/import of views and materialized views
URL: https://github.com/apache/hive/pull/969#discussion_r408996757
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplLoadTask.java
 ##########
 @@ -282,6 +295,32 @@ a database ( directory )
     return 0;
   }
 
+  public static Task<?> createViewTask(MetaData metaData, String 
dbNameToLoadIn, HiveConf conf)
+      throws SemanticException {
+    Table table = new Table(metaData.getTable());
+    String dbName = dbNameToLoadIn == null ? table.getDbName() : 
dbNameToLoadIn;
+    TableName tableName = HiveTableName.ofNullable(table.getTableName(), 
dbName);
+    String dbDotView = tableName.getNotEmptyDbTable();
+    CreateViewDesc desc = new CreateViewDesc(dbDotView, table.getAllCols(), 
null, table.getParameters(),
+        table.getPartColNames(), false, false, false, 
table.getSd().getInputFormat(), table.getSd().getOutputFormat(),
+        table.getSd().getSerdeInfo().getSerializationLib());
+    String originalText = table.getViewOriginalText();
+    String expandedText = table.getViewExpandedText();
+
+    if (!dbName.equals(table.getDbName())) {
+      // TODO: If the DB name doesn't match with the metadata from dump, then 
need to rewrite the original and expanded
+      // texts using new DB name. Currently it refers to the source database 
name.
+    }
+
+    desc.setViewOriginalText(originalText);
+    desc.setViewExpandedText(expandedText);
+    desc.setPartCols(table.getPartCols());
+    desc.setReplicationSpec(metaData.getReplicationSpec());
 
 Review comment:
   In it's current state it seems to me that replication is not supported 
materialized views at all, I guess that is why 
TestReplicationWithTableMigrationEx has no materialized views in it. I've tried 
to add it, but the replication dump failed, it couldn't handle it.

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


With regards,
Apache Git Services

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

Reply via email to