apache calcite – How to execute a LogicalTableModify node?
This question is a follow up on the StackOverflow answer that described how to create a LogicalTableModify
node for DML operations: stackoverflow.com/a/45364366/13036362
I’m wondering what are the steps needed to execute a LogicalTableModify
node on a JDBC data source. I’ve created a LogicalTableModify
through the JdbcTable.toModificationRel
method, but I’m not sure how to execute it.
Here is the code I’ve attempted, where I try to insert a row into a JDBC table and execute it using RelRunners.run
:
RelNode values = relBuilder.values(rowType, "4", "D", "d@example.com").build();
TableModify modify = jdbcTable.toModificationRel(cluster, relOptTable, catalogReader, values , TableModify.Operation.INSERT, null, null, true);
PreparedStatement ps = RelRunners.run(modify);
ps.execute();
I encountered a stack overflow error after running this piece of code due to NoneToBindableConverterRule
rule being applied indefinitely. So I’m wondering what is the right way to execute LogicalTableModify
. Thank you.
Read more here: Source link