@@ -198,6 +198,42 @@ public void testTableTemplateWithKey_withSchema(boolean useHttp) {
198198 httpPort );
199199 }
200200
201+ @ Test
202+ public void testTombstoneRecordFilter () {
203+ connect .kafka ().createTopic (topicName , 1 );
204+ Map <String , String > props = ConnectTestUtils .baseConnectorProps (questDBContainer , topicName , true );
205+ props .put (QuestDBSinkConnectorConfig .INCLUDE_KEY_CONFIG , "false" );
206+
207+ // this FILTER transform is no longer needed since the connector filters out tombstone records by default
208+ // props.put("transforms", "filterTombstones");
209+ // props.put("transforms.filterTombstones.type", "org.apache.kafka.connect.transforms.Filter");
210+ // props.put("transforms.filterTombstones.predicate", "isTombstone");
211+ // props.put("predicates", "isTombstone");
212+ // props.put("predicates.isTombstone.type", "org.apache.kafka.connect.transforms.predicates.RecordIsTombstone");
213+
214+ connect .configureConnector (ConnectTestUtils .CONNECTOR_NAME , props );
215+ ConnectTestUtils .assertConnectorTaskRunningEventually (connect );
216+
217+ Schema schema = SchemaBuilder .struct ().name ("com.example.Person" )
218+ .field ("firstname" , Schema .STRING_SCHEMA )
219+ .field ("lastname" , Schema .STRING_SCHEMA )
220+ .field ("age" , Schema .INT8_SCHEMA )
221+ .build ();
222+
223+ Struct struct = new Struct (schema )
224+ .put ("firstname" , "John" )
225+ .put ("lastname" , "Doe" )
226+ .put ("age" , (byte ) 42 );
227+
228+ connect .kafka ().produce (topicName , "key" , new String (converter .fromConnectData (topicName , schema , struct )));
229+ connect .kafka ().produce (topicName , "key" , null );
230+
231+ QuestDBUtils .assertSqlEventually ( "\" firstname\" ,\" lastname\" ,\" age\" \r \n "
232+ + "\" John\" ,\" Doe\" ,42\r \n " ,
233+ "select firstname,lastname,age from " + topicName ,
234+ httpPort );
235+ }
236+
201237 @ ParameterizedTest
202238 @ ValueSource (booleans = {true , false })
203239 public void testTableTemplateWithKey_schemaless (boolean useHttp ) {
0 commit comments