Search in sources :

Example 1 with QueryIndexDescriptorImpl

use of org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl in project ignite by apache.

the class AbstractSchemaSelfTest method assertIndex.

/**
     * Assert index state.
     *
     * @param typeDesc Type descriptor.
     * @param idxName Index name.
     * @param fields Fields (order is important).
     */
protected static void assertIndex(QueryTypeDescriptorImpl typeDesc, String idxName, IgniteBiTuple<String, Boolean>... fields) {
    QueryIndexDescriptorImpl idxDesc = typeDesc.index(idxName);
    assertNotNull(idxDesc);
    assertEquals(idxName, idxDesc.name());
    assertEquals(typeDesc, idxDesc.typeDescriptor());
    assertEquals(QueryIndexType.SORTED, idxDesc.type());
    List<String> fieldNames = new ArrayList<>(idxDesc.fields());
    assertEquals(fields.length, fieldNames.size());
    for (int i = 0; i < fields.length; i++) {
        String expFieldName = fields[i].get1();
        boolean expFieldAsc = fields[i].get2();
        assertEquals("Index field mismatch [pos=" + i + ", expField=" + expFieldName + ", actualField=" + fieldNames.get(i) + ']', expFieldName.toLowerCase(), fieldNames.get(i).toLowerCase());
        boolean fieldAsc = !idxDesc.descending(expFieldName);
        assertEquals("Index field sort mismatch [pos=" + i + ", field=" + expFieldName + ", expAsc=" + expFieldAsc + ", actualAsc=" + fieldAsc + ']', expFieldAsc, fieldAsc);
    }
}
Also used : ArrayList(java.util.ArrayList) QueryIndexDescriptorImpl(org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl)

Example 2 with QueryIndexDescriptorImpl

use of org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl in project ignite by apache.

the class AbstractSchemaSelfTest method assertInternalIndexParams.

/**
 * Assert index details not available via JDBC.
 * @param typeDesc Type descriptor.
 * @param idxName Index name.
 * @param inlineSize Inline size.
 */
private static void assertInternalIndexParams(QueryTypeDescriptorImpl typeDesc, String idxName, int inlineSize) {
    QueryIndexDescriptorImpl idxDesc = typeDesc.index(idxName);
    assertNotNull(idxDesc);
    assertEquals(idxName, idxDesc.name());
    assertEquals(typeDesc, idxDesc.typeDescriptor());
    assertEquals(QueryIndexType.SORTED, idxDesc.type());
    assertEquals(inlineSize, idxDesc.inlineSize());
}
Also used : QueryIndexDescriptorImpl(org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl)

Aggregations

QueryIndexDescriptorImpl (org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl)2 ArrayList (java.util.ArrayList)1