-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces NativeEngineKNNQuery which executes ANN on rewrite (#1877)
Signed-off-by: Tejas Shah <[email protected]>
- Loading branch information
Showing
15 changed files
with
952 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/opensearch/knn/common/featureflags/KNNFeatureFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.opensearch.knn.common.featureflags; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import lombok.experimental.UtilityClass; | ||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.knn.index.KNNSettings; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import static org.opensearch.common.settings.Setting.Property.Dynamic; | ||
import static org.opensearch.common.settings.Setting.Property.NodeScope; | ||
|
||
/** | ||
* Class to manage KNN feature flags | ||
*/ | ||
@UtilityClass | ||
public class KNNFeatureFlags { | ||
|
||
// Feature flags | ||
private static final String KNN_LAUNCH_QUERY_REWRITE_ENABLED = "knn.feature.query.rewrite.enabled"; | ||
private static final boolean KNN_LAUNCH_QUERY_REWRITE_ENABLED_DEFAULT = true; | ||
|
||
@VisibleForTesting | ||
public static final Setting<Boolean> KNN_LAUNCH_QUERY_REWRITE_ENABLED_SETTING = Setting.boolSetting( | ||
KNN_LAUNCH_QUERY_REWRITE_ENABLED, | ||
KNN_LAUNCH_QUERY_REWRITE_ENABLED_DEFAULT, | ||
NodeScope, | ||
Dynamic | ||
); | ||
|
||
public static List<Setting<?>> getFeatureFlags() { | ||
return Stream.of(KNN_LAUNCH_QUERY_REWRITE_ENABLED_SETTING).collect(Collectors.toUnmodifiableList()); | ||
} | ||
|
||
public static boolean isKnnQueryRewriteEnabled() { | ||
return Boolean.parseBoolean(KNNSettings.state().getSettingValue(KNN_LAUNCH_QUERY_REWRITE_ENABLED).toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.