@VisibleForTesting
  boolean find(String searchField) {
    Pattern p = Pattern.compile(searchField);
    for (PartitionFieldNode node : roots) {
      if (find(node, p)) {
        return true;
      }
    }
    return false;
  }
@Test
  public void testFind() throws MetaException {
    PersistenceManager mockPm = Mockito.mock(PersistenceManager.class);
    List<String> projectionFields = Arrays.asList("sd", "createTime", "sd.location", "parameters");
    PartitionProjectionEvaluator projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SD_PATTERN));

    projectionFields = Arrays.asList("sd", "createTime", "parameters");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.serdeInfo.serializationLib");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.location");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.location");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertFalse(projectionEvaluator.find(SERDE_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.serdeInfo.serializationLib");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SERDE_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.serdeInfo");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(SERDE_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertFalse(projectionEvaluator.find(SD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.cols");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(CD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd.cols.name");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    Assert.assertTrue(projectionEvaluator.find(CD_PATTERN));

    projectionFields = Arrays.asList("createTime", "parameters", "sd", "sd.location");
    projectionEvaluator =
        new PartitionProjectionEvaluator(mockPm, fieldNameToColumnName, projectionFields, false,
            false, null, null);
    // CD_PATTERN should exist since sd gets expanded to all the child nodes
    Assert.assertTrue(projectionEvaluator.find(CD_PATTERN));
  }