Hello,

I've got a JdbcTable that I'm trying to insert a row into. I found that I could 
create a TableModify node by calling the JdbcTable.toModificationRel(...) 
method. So to test this, I created a LogicalValues node using RelBuilder, 
called RelRunners.run(rel), and then executed the prepared statement. My code 
looked something like this:


RelNode values = relBuilder.values(rowType, "4", "D", 
"[email protected]").build();

TableModify modify = jdbcTable.toModificationRel(cluster, relOptTable, 
catalogReader, values , TableModify.Operation.INSERT, null, null, true);

PreparedStatement ps = RelRunners.run(modify);

ps.execute();

But I got a stack overflow error when I tried running this. I found it was due 
to NoneToBindableConverterRule being fired indefinitely. Initially, the 
TableModify node only had one input, the LogicalValues node. So there were just 
two vertices in the HepPlanner’s graph:


 1. HepRelVertex@187 "rel#9:HepRelVertex(rel#0:LogicalValues.NONE.[[0, 1, 2], 
[1, 2] [2]](type=RecordType(INTEGER ID, VARCHAR(50) NAME, VARCHAR(50) 
EMAIL),tuples=[{ 4, D, [email protected]' }]))"

 2. HepRelVertex@188 
"rel#11:HepRelVertex(rel#10:LogicalTableModify.(input=HepRelVertex#9,table=[PUBLIC,
 EMPLOYEE],operation=INSERT,flattened=true))"

Whenever the NoneToBindableConverterRule was applied onto the LogicalValues 
vertex, it added an InterpretableConverter vertex above the LogicalValues 
vertex. This kept repeating every time the rule was recursively applied onto 
the existing LogicalValues vertex, making a new InterpretableConverter kept 
getting inserted below the previously created InterpretableConverter and above 
the LogicalValues vertex. So after a few cycles in, the vertices in the 
HepPlanner graph looked like this:

1. HepRelVertex@188 
"rel#11:HepRelVertex(rel#10:LogicalTableModify.(input=HepRelVertex#15,table=[PUBLIC,
 EMPLOYEE],operation=INSERT,flattened=true))"
2. HepRelVertex@206 
"rel#15:HepRelVertex(rel#14:InterpretableConverter.BINDABLE.[[0, 1, 2], [1, 2], 
[2]](input=HepRelVertex#19))"
3. HepRelVertex@237 
"rel#19:HepRelVertex(rel#18:InterpretableConverter.BINDABLE.[[0, 1, 2], [1, 2], 
[2]](input=HepRelVertex#23))"
4. HepRelVertex@253 
"rel#23:HepRelVertex(rel#22:InterpretableConverter.BINDABLE.[[0, 1, 2], [1, 2], 
[2]](input=HepRelVertex#27))"
5. HepRelVertex@279 "rel#25:HepRelVertex(rel#0:LogicalValues.NONE.[[0, 1, 2], 
[1, 2], [2]](type=RecordType(INTEGER ID, VARCHAR(50) NAME, VARCHAR(50) 
EMAIL),tuples=[{ 4, D, [email protected]' }]))"
6. HepRelVertex@269 
"rel#27:HepRelVertex(rel#26:InterpretableConverter.BINDABLE.[[0, 1, 2], [1, 2], 
[2]](input=HepRelVertex#25))"

Please help, as I’m a beginner and am not sure where the problem lies. Please 
let me know what I should’ve done. Thank you.

Regards,
Alvin

Reply via email to