in java/clickhouse-connector/src/integration-test/java/com/epam/deltix/timebase/connector/clickhouse/CustomTableSchemaTests.java [59:100]
void replicationInExistingTableWithDifferentSchema() throws SQLException {
String sqlExpression = "CREATE TABLE " + tableName + "\n" +
"(\n" +
" `partition` Date,\n" +
" `timestamp` DateTime64(9),\n" +
" `instrument` String,\n" +
" `type` String,\n" +
" `FieldNameMessage_objectArray.type` Array(Nullable(String)),\n" +
" `FieldNameMessage_objectArray.FirstSubFieldObject_int32Field` Array(Nullable(Int32)),\n" +
" `FieldNameMessage_objectArray.FirstSubFieldObject_simpleField` Array(Nullable(String)),\n" +
" `FieldNameMessage_objectArray.SecondSubFieldObject_int32Field` Array(Nullable(Int32)),\n" +
" `FieldNameMessage_objectArray.SecondSubFieldObject_simpleField` Array(Nullable(Enum16('FIRST' = 0, 'SECOND' = 1, 'DEFAULT' = 2))),\n" +
//skipped field " `FieldNameMessage_simpleField` Nullable(String),\n" +
" `FieldNameMessage_simpleObject_type` Nullable(String),\n" +
//skipped field " `FieldNameMessage_simpleObject_FirstSubFieldObject_int32Field` Nullable(Int32),\n" +
" `FieldNameMessage_simpleObject_FirstSubFieldObject_simpleField` Nullable(String),\n" +
" `FieldNameMessage_simpleObject_SecondSubFieldObject_int32Field` Nullable(Int32),\n" +
" `FieldNameMessage_simpleObject_SecondSubFieldObject_simpleField` Nullable(Enum16('FIRST' = 0, 'SECOND' = 1, 'DEFAULT' = 2))\n" +
")\n" +
"ENGINE = MergeTree\n" +
"PARTITION BY partition\n" +
"ORDER BY (timestamp, instrument)\n" +
"SETTINGS index_granularity = 8192";
clickhouseClient.executeExpression(sqlExpression);
TableDeclaration clickhouseTable = prepareClickhouseTable(stream).get(ALL_TYPES);
TableDeclaration tableDeclaration = Util.getTableDeclaration(stream);
assertColumnsCount(clickhouseTable, 13);
assertColumnsCount(tableDeclaration, 15);
startStreamReplication(stream, clickhouseTable.getTableIdentity());
Map<String, Object> values = selectAllValues(clickhouseTable).get(0);
assertEquals(13, values.size());
assertFalse(values.containsKey("FieldNameMessage_simpleObject_FirstSubFieldObject_int32Field"));
assertFalse(values.containsKey("FieldNameMessage_simpleField"));
assertTrue(values.containsKey("FieldNameMessage_objectArray.SecondSubFieldObject_simpleField"));
assertTrue(values.containsKey("FieldNameMessage_simpleObject_SecondSubFieldObject_int32Field"));
clickhouseClient.dropTable(tableDeclaration.getTableIdentity());
}