JiajunBernoulli commented on code in PR #3442:
URL: https://github.com/apache/calcite/pull/3442#discussion_r1359264724
##########
server/src/main/java/org/apache/calcite/server/ServerDdlExecutor.java:
##########
@@ -558,6 +568,71 @@ public void execute(SqlCreateTable create,
}
}
+ /** Executes a {@code CREATE TABLE LIKE} command. */
+ public void execute(SqlCreateTableLike create,
+ CalcitePrepare.Context context) {
+ final Pair<CalciteSchema, String> pair = schema(context, true,
create.name);
+ final JavaTypeFactory typeFactory = context.getTypeFactory();
+ final Table table = table(context, create.sourceTable);
+ final RelDataType rowType = table.getRowType(typeFactory);
+ InitializerExpressionFactory ief =
NullInitializerExpressionFactory.INSTANCE;
+ if (table instanceof Wrapper) {
+ final InitializerExpressionFactory sourceIef =
+ ((Wrapper) table).unwrap(InitializerExpressionFactory.class);
+ if (sourceIef != null) {
+ final Set<SqlCreateTableLike.LikeOption> optionSet = create.options();
+ final boolean includingGenerated =
+ optionSet.contains(SqlCreateTableLike.LikeOption.GENERATED)
+ || optionSet.contains(SqlCreateTableLike.LikeOption.ALL);
+ final boolean includingDefaults =
+ optionSet.contains(SqlCreateTableLike.LikeOption.DEFAULTS)
+ || optionSet.contains(SqlCreateTableLike.LikeOption.ALL);
+ ief = new NullInitializerExpressionFactory() {
Review Comment:
Need class name and document, not anonymous class.
--
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]