Skip to content

Commit

Permalink
Update to use OpenSearchDSL
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Aug 22, 2023
1 parent 3b8d006 commit ba5b851
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 915 deletions.
52 changes: 0 additions & 52 deletions core/src/main/java/org/opensearch/sql/expression/DSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,6 @@ public static FunctionExpression xor(Expression... expressions) {
return compile(FunctionProperties.None, BuiltinFunctionName.XOR, expressions);
}

public static FunctionExpression nested(Expression... expressions) {
return compile(FunctionProperties.None, BuiltinFunctionName.NESTED, expressions);
}

public static FunctionExpression not(Expression... expressions) {
return compile(FunctionProperties.None, BuiltinFunctionName.NOT, expressions);
}
Expand Down Expand Up @@ -827,54 +823,6 @@ public static FunctionExpression typeof(Expression value) {
return compile(FunctionProperties.None, BuiltinFunctionName.TYPEOF, value);
}

public static FunctionExpression match(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.MATCH, args);
}

public static FunctionExpression match_phrase(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.MATCH_PHRASE, args);
}

public static FunctionExpression match_phrase_prefix(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.MATCH_PHRASE_PREFIX, args);
}

public static FunctionExpression multi_match(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.MULTI_MATCH, args);
}

public static FunctionExpression simple_query_string(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.SIMPLE_QUERY_STRING, args);
}

public static FunctionExpression query(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.QUERY, args);
}

public static FunctionExpression query_string(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.QUERY_STRING, args);
}

public static FunctionExpression match_bool_prefix(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.MATCH_BOOL_PREFIX, args);
}

public static FunctionExpression wildcard_query(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.WILDCARD_QUERY, args);
}

public static FunctionExpression score(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.SCORE, args);
}

public static FunctionExpression scorequery(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.SCOREQUERY, args);
}

public static FunctionExpression score_query(Expression... args) {
return compile(FunctionProperties.None, BuiltinFunctionName.SCORE_QUERY, args);
}

public static FunctionExpression now(FunctionProperties functionProperties, Expression... args) {
return compile(functionProperties, BuiltinFunctionName.NOW, args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ public static synchronized BuiltinFunctionRepository getInstance(DataSourceServi
for (DataSourceMetadata metadata : dataSourceService.getDataSourceMetadata(true)) {
dataSourceService
.getDataSource(metadata.getName())
.getStorageEngine().getFunctions().
forEach(repository::register);
.getStorageEngine()
.getFunctions()
.forEach(repository::register);
}
}
instance.put(dataSourceServiceHash, repository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public OpenSearchDataSourceMetadataStorage(

@Override
public List<DataSourceMetadata> getDataSourceMetadata() {
if (this.clusterService.state() == null) {
return Collections.emptyList();

Check warning on line 84 in datasources/src/main/java/org/opensearch/sql/datasources/storage/OpenSearchDataSourceMetadataStorage.java

View check run for this annotation

Codecov / codecov/patch

datasources/src/main/java/org/opensearch/sql/datasources/storage/OpenSearchDataSourceMetadataStorage.java#L84

Added line #L84 was not covered by tests
}
if (!this.clusterService.state().routingTable().hasIndex(DATASOURCE_INDEX_NAME)) {
createDataSourcesIndex();
return Collections.emptyList();
Expand Down
Loading

0 comments on commit ba5b851

Please sign in to comment.