Skip to content

Commit

Permalink
[FLINK-22102][hive] Throw meaningful exceptions for unsupported DDLs (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
lirui-apache committed Apr 8, 2021
1 parent 8550d82 commit 561fabb
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.flink.connectors.hive.FlinkHiveException;
import org.apache.flink.table.api.SqlParserException;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.table.api.ValidationException;
import org.apache.flink.table.catalog.Catalog;
import org.apache.flink.table.catalog.CatalogManager;
import org.apache.flink.table.catalog.hive.HiveCatalog;
Expand Down Expand Up @@ -161,7 +162,8 @@ public class HiveParser extends ParserImpl {
HiveASTParser.TOK_DROPFUNCTION,
HiveASTParser.TOK_RELOADFUNCTION,
HiveASTParser.TOK_CREATEVIEW,
HiveASTParser.TOK_ALTERDATABASE_LOCATION));
HiveASTParser.TOK_ALTERDATABASE_LOCATION,
HiveASTParser.TOK_CREATE_MATERIALIZED_VIEW));
}

private final PlannerContext plannerContext;
Expand Down Expand Up @@ -233,10 +235,7 @@ private List<Operation> processCmd(
HiveParserQueryState queryState = new HiveParserQueryState(hiveConf);
HiveParserDDLSemanticAnalyzer ddlAnalyzer =
new HiveParserDDLSemanticAnalyzer(
queryState,
context,
hiveCatalog,
getCatalogManager().getCurrentDatabase());
queryState, hiveCatalog, getCatalogManager().getCurrentDatabase());
Serializable work = ddlAnalyzer.analyzeInternal(node);
DDLOperationConverter ddlConverter =
new DDLOperationConverter(this, getCatalogManager(), hiveShim);
Expand Down Expand Up @@ -291,7 +290,7 @@ private List<Operation> processCmd(
throw new SqlParserException("SQL parse failed", e);
}
} catch (SemanticException e) {
throw new FlinkHiveException("HiveParser failed to parse " + cmd, e);
throw new ValidationException("HiveParser failed to parse " + cmd, e);
}
}

Expand Down
Loading

0 comments on commit 561fabb

Please sign in to comment.