class AbstractIndexDescriptorFactory implements IndexDescriptorFactory {
    /** */
    protected static LinkedHashMap<String, IndexKeyDefinition> indexDescriptorToKeysDefinition(
        GridQueryIndexDescriptor idxDesc,
        GridQueryTypeDescriptor typeDesc
    ) {
        LinkedHashMap<String, IndexKeyDefinition> keyDefs = new LinkedHashMap<>(idxDesc.fields().size());

        for (String field : idxDesc.fields())
            keyDefs.put(field, keyDefinition(typeDesc, field, !idxDesc.descending(field)));

        return keyDefs;
    }

    /** */
    protected static IndexKeyDefinition keyDefinition(GridQueryTypeDescriptor typeDesc, String field, boolean ascOrder) {<FILL_FUNCTION_BODY>}
}

        Order order = new Order(ascOrder ? SortOrder.ASC : SortOrder.DESC, null);

        GridQueryProperty prop = typeDesc.property(field);

        // Try to find property by alternative key field name.
        if (prop == null && F.eq(field, QueryUtils.KEY_FIELD_NAME) && !F.isEmpty(typeDesc.keyFieldName()))
            prop = typeDesc.property(typeDesc.keyFieldName());

        Class<?> fieldType = F.eq(field, QueryUtils.KEY_FIELD_NAME) ? typeDesc.keyClass() :
            F.eq(field, QueryUtils.VAL_FIELD_NAME) ? typeDesc.valueClass() : prop.type();

        int fieldPrecision = prop != null ? prop.precision() : -1;

        return new IndexKeyDefinition(IndexKeyType.forClass(fieldType).code(), order, fieldPrecision);
    
<no_super_class>