def METHOD_NAME():
    """
    Test the 'pivoted' query only. Check whether the number of pilots in different states returned by
    the query is correct.
    :return: None
    """
    # PivotedPilotSummaryTable pstates gives pilot possible states (table.pstates)
    # pstates = ['Submitted', 'Done', 'Failed', 'Aborted', 'Running', 'Waiting', 'Scheduled', 'Ready']
    stateCount = [10, 50, 7, 3, 12, 8, 6, 4]
    testGroup = "ownerGroup"
    testCE = "TestCE"
    testSite = "TestSite"
    pilotRef = preparePilots(stateCount, testSite, testCE, testGroup)
    table = PivotedPilotSummaryTable(["GridSite", "DestinationSite", "OwnerGroup"])
    sqlQuery = table.buildSQL()
    res = paDB._query(sqlQuery)
    assert res["OK"] is True, res["Message"]
    columns = table.getColumnList()
    # first 3 columns are: Site, CE and a group (VO mapping comes later, not in the SQL above)
    assert "Site" in columns
    assert columns.index("Site") == 0
    assert "CE" in columns
    assert columns.index("CE") == 1
    assert "OwnerGroup" in columns
    assert columns.index("OwnerGroup") == 2
    # pilot numbers by states:
    assert "Total" in columns
    # with the setup above there will be only one row, first 3 elements must match the columns.
    row = res["Value"][0]
    assert row[0] == testSite
    assert row[1] == testCE
    assert row[2] == testGroup
    total = row[columns.index("Total")]
    assert total == sum(stateCount), res["Value"]
    for i, state in enumerate(table.pstates):
        assert state in columns
        assert row[columns.index(state)] == stateCount[i], " state: %s, stateCount: %d " % (state, stateCount[i])
    cleanUpPilots(pilotRef)