コード例 #1
0
 public Pair<IndexMultiKey, EventTableAndNamePair> findTable(
     Set<String> keyPropertyNames,
     Set<String> rangePropertyNames,
     List<IndexHintInstruction> optionalIndexHintInstructions) {
   Pair<IndexMultiKey, EventTableIndexEntryBase> pair =
       EventTableIndexUtil.findIndexBestAvailable(
           tableIndexesRefCount,
           keyPropertyNames,
           rangePropertyNames,
           optionalIndexHintInstructions);
   if (pair == null) {
     return null;
   }
   EventTable tableFound = ((EventTableIndexRepositoryEntry) pair.getSecond()).getTable();
   return new Pair<IndexMultiKey, EventTableAndNamePair>(
       pair.getFirst(),
       new EventTableAndNamePair(tableFound, pair.getSecond().getOptionalIndexName()));
 }
コード例 #2
0
  public void validateAddExplicitIndex(
      boolean unique,
      String indexName,
      List<CreateIndexItem> columns,
      EventType eventType,
      Iterable<EventBean> dataWindowContents)
      throws ExprValidationException {
    if (explicitIndexes.containsKey(indexName)) {
      throw new ExprValidationException("Index by name '" + indexName + "' already exists");
    }

    EventTableCreateIndexDesc desc =
        EventTableIndexUtil.validateCompileExplicitIndex(unique, columns, eventType);
    Pair<IndexMultiKey, EventTableAndNamePair> pair =
        addExplicitIndexOrReuse(
            unique,
            desc.getHashProps(),
            desc.getBtreeProps(),
            dataWindowContents,
            eventType,
            indexName);
    explicitIndexes.put(indexName, pair.getSecond().getEventTable());
  }
コード例 #3
0
  public Pair<IndexMultiKey, EventTableAndNamePair> addExplicitIndexOrReuse(
      boolean unique,
      List<IndexedPropDesc> hashProps,
      List<IndexedPropDesc> btreeProps,
      Iterable<EventBean> prefilledEvents,
      EventType indexedType,
      String indexName) {
    if (hashProps.isEmpty() && btreeProps.isEmpty()) {
      throw new IllegalArgumentException("Invalid zero element list for hash and btree columns");
    }

    // Get an existing table, if any, matching the exact requirement
    IndexMultiKey indexPropKeyMatch =
        EventTableIndexUtil.findExactMatchNameAndType(
            tableIndexesRefCount.keySet(), unique, hashProps, btreeProps);
    if (indexPropKeyMatch != null) {
      EventTableIndexRepositoryEntry refTablePair = tableIndexesRefCount.get(indexPropKeyMatch);
      return new Pair<IndexMultiKey, EventTableAndNamePair>(
          indexPropKeyMatch,
          new EventTableAndNamePair(refTablePair.getTable(), refTablePair.getOptionalIndexName()));
    }

    return addIndex(unique, hashProps, btreeProps, prefilledEvents, indexedType, indexName, false);
  }