void replicationInExistingTableWithoutPartitionColumn()

in java/clickhouse-connector/src/integration-test/java/com/epam/deltix/timebase/connector/clickhouse/CustomTableSchemaTests.java [104:145]


    void replicationInExistingTableWithoutPartitionColumn() 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" +
                "    `FieldNameMessage_simpleField` Nullable(String),\n" +
                "    `FieldNameMessage_simpleObject_type` Nullable(String),\n" +
                "    `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);
        assertFalse(clickhouseTable.getColumns().stream().map(ColumnDeclaration::getDbColumnName).anyMatch(SchemaProcessor.PARTITION_COLUMN_NAME::equals));
        assertTrue(tableDeclaration.getColumns().stream().map(ColumnDeclaration::getDbColumnName).anyMatch(SchemaProcessor.PARTITION_COLUMN_NAME::equals));

        StreamRequest streamRequest = new StreamRequest();
        streamRequest.setKey(stream.getKey());
        streamRequest.setStream(stream.getKey());
        streamRequest.setColumnNamingScheme(ColumnNamingScheme.TYPE_AND_NAME);
        streamRequest.setIncludePartitionColumn(false);
        startStreamReplication(stream, tableDeclaration.getTableIdentity(), 1, 1, 1, streamRequest);

        Map<String, Object> values = selectAllValues(clickhouseTable).get(0);
        assertFalse(values.containsKey(SchemaProcessor.PARTITION_COLUMN_NAME));

        clickhouseClient.dropTable(tableDeclaration.getTableIdentity());
    }