@Override
        public void write(final Key key, final DataWriter writer) {
            // Write number of key parts (depth).
            writer.writeByteUnsigned(key.getKeyParts().size());

            // Write time millis since epoch.
            writer.writeLong(key.getTimeMs());

            // Write key parts.
            for (final KeyPart keyPart : key.getKeyParts()) {
                // Record if this is a grouped part.
                writer.writeBoolean(keyPart.isGrouped());
                keyPart.write(writer);
            }
        }
Creates a nested time based group key. <DEPTH><TIME_MS><LIST OF GROUP VAL ARRAYS>
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/KeyFactoryFactory.java