SourabhBadhya commented on code in PR #3715:
URL: https://github.com/apache/hive/pull/3715#discussion_r1023529583


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7990,19 +7998,29 @@ protected boolean enableColumnStatsCollecting() {
     return true;
   }
 
-  private Path getCtasLocation(CreateTableDesc tblDesc, boolean 
createTableWithSuffix) throws SemanticException {
+  private Path getCtasOrCMVLocation(CreateTableDesc tblDesc, 
CreateMaterializedViewDesc viewDesc,
+                               boolean createTableWithSuffix) throws 
SemanticException {
     Path location;
+    String protoName;
+    String[] names;
+    Table tbl;
     try {
-      String protoName = tblDesc.getDbTableName();
-      String[] names = Utilities.getDbTableName(protoName);
-
-      // Handle table translation initially and if not present
-      // use default table path.
-      // Property modifications of the table is handled later.
-      // We are interested in the location if it has changed
-      // due to table translation.
-      Table tbl = tblDesc.toTable(conf);
-      tbl = db.getTranslateTableDryrun(tbl.getTTable());
+      if (tblDesc != null) {
+        protoName = tblDesc.getDbTableName();
+        names = Utilities.getDbTableName(protoName);
+
+        // Handle table translation initially and if not present
+        // use default table path.
+        // Property modifications of the table is handled later.
+        // We are interested in the location if it has changed
+        // due to table translation.
+        tbl = tblDesc.toTable(conf);
+        tbl = db.getTranslateTableDryrun(tbl.getTTable());

Review Comment:
   @deniskuzZ 
   With some guidance from @kasakrisz I checked the transformer implementation 
and was able to conclude the following -
   `transformCreateTable()`  only handles 2 types - Transactional table 
(Managed table) & External table.
   
[https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/s[…]g/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java#L644)
 - For Managed table
   
[https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/s[…]g/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java#L704)
 - For external table
   
   Since the table type for Materialized view is `MATERIALIZED_VIEW`. The table 
object is never translated.



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

Reply via email to