You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/05/02 09:03:37 UTC

[GitHub] [calcite] yanlin-Lynn commented on a change in pull request #1915: [CALCITE-3921] Support serialize TableModify to json string and deserialize from it

yanlin-Lynn commented on a change in pull request #1915:
URL: https://github.com/apache/calcite/pull/1915#discussion_r418933994



##########
File path: core/src/test/java/org/apache/calcite/plan/RelWriterTest.java
##########
@@ -895,6 +898,38 @@ private RelNode mockCountOver(String table,
     assertThat(s, isLinux(expected));
   }
 
+  @Test void testTableModify() {
+    final FrameworkConfig config = RelBuilderTest.config().build();
+    final RelBuilder builder = RelBuilder.create(config);
+    final RexBuilder rexBuilder = builder.getRexBuilder();
+    LogicalTableScan scan = (LogicalTableScan) builder.scan("EMP").build();
+    List<RexNode> projExprs = new ArrayList<>();
+    int inputFieldNum = scan.getRowType().getFieldCount();
+    for (int i = 0; i < inputFieldNum; i++) {
+      RexNode projExpr = rexBuilder.makeInputRef(scan, i);
+      projExprs.add(projExpr);
+    }
+    LogicalProject project = LogicalProject.create(
+        scan, ImmutableList.of(), projExprs, scan.getRowType());
+    LogicalTableModify modify = LogicalTableModify.create(
+        scan.getTable(),
+        (Prepare.CatalogReader) scan.getTable().getRelOptSchema(),
+        project,
+        TableModify.Operation.INSERT,
+        null,

Review comment:
       yes, I agree.




----------------------------------------------------------------
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:
users@infra.apache.org