CREATE OR REPLACE VIEW converts to the same plan as plain CREATE VIEW, so the replace request is lost. DdlSqlToRelConverter.handleCreateView never reads SqlCreateView.getReplace(), and SubstraitRelVisitor.handleCreateView hard-codes DDL_OP_CREATE:
|
protected RelRoot handleCreateView(final SqlCreateView sqlCreateView) { |
|
final RelNode input = converter.convertQuery(sqlCreateView.query, true, true).rel; |
|
final RelDataType schema = declaredSchema(sqlCreateView.columnList, input); |
|
return RelRoot.of( |
|
schema == null |
|
? new CreateView(sqlCreateView.name.names, input) |
|
: new CreateView(sqlCreateView.name.names, schema, input), |
|
sqlCreateView.getKind()); |
|
} |
|
.operation(AbstractDdlRel.DdlOp.CREATE) |
CREATE VIEW v1 AS SELECT v FROM src -> ddl.op = DDL_OP_CREATE
CREATE OR REPLACE VIEW v1 AS SELECT v FROM src -> ddl.op = DDL_OP_CREATE
Measured on main at d05cd6b. The spec defines DDL_OP_CREATE_OR_REPLACE for this. The reverse direction, SubstraitRelNodeConverter.visit(NamedDdl), accepts only DDL_OP_CREATE, so it needs to accept the new op too, and CreateView needs to carry it the way CreateTable now carries its create mode (#1266).
CREATE OR REPLACE VIEWconverts to the same plan as plainCREATE VIEW, so the replace request is lost.DdlSqlToRelConverter.handleCreateViewnever readsSqlCreateView.getReplace(), andSubstraitRelVisitor.handleCreateViewhard-codesDDL_OP_CREATE:substrait-java/isthmus/src/main/java/io/substrait/isthmus/calcite/rel/DdlSqlToRelConverter.java
Lines 132 to 140 in d05cd6b
substrait-java/isthmus/src/main/java/io/substrait/isthmus/SubstraitRelVisitor.java
Line 952 in d05cd6b
Measured on
mainat d05cd6b. The spec definesDDL_OP_CREATE_OR_REPLACEfor this. The reverse direction,SubstraitRelNodeConverter.visit(NamedDdl), accepts onlyDDL_OP_CREATE, so it needs to accept the new op too, andCreateViewneeds to carry it the wayCreateTablenow carries its create mode (#1266).