forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e838e46
commit 55e899d
Showing
8 changed files
with
117 additions
and
2 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
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
43 changes: 43 additions & 0 deletions
43
core/src/main/java/org/opensearch/sql/expression/geospatial/GeospatialFunction.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,43 @@ | ||
package org.opensearch.sql.expression.geospatial; | ||
|
||
import static org.opensearch.sql.expression.function.FunctionDSL.define; | ||
import static org.opensearch.sql.expression.function.FunctionDSL.impl; | ||
|
||
import lombok.Builder; | ||
import lombok.experimental.UtilityClass; | ||
import org.opensearch.geospatial.spl | ||
import org.opensearch.sql.expression.function.BuiltinFunctionName; | ||
import org.opensearch.sql.expression.function.BuiltinFunctionRepository; | ||
import org.opensearch.sql.expression.function.DefaultFunctionResolver; | ||
import org.opensearch.sql.expression.function.FunctionName; | ||
|
||
@UtilityClass | ||
public class GeospatialFunction { | ||
/** | ||
* Register Geospatial Functions. | ||
* | ||
* @param repository {@link BuiltinFunctionRepository}. | ||
*/ | ||
public void register(BuiltinFunctionRepository repository) { | ||
repository.register(geoip()); | ||
} | ||
|
||
private DefaultFunctionResolver geoipIplocation(FunctionName functionName) { | ||
return define( | ||
functionName, | ||
impl( | ||
, | ||
STRING, | ||
STRING | ||
) | ||
); | ||
} | ||
|
||
private DefaultFunctionResolver geoip() { | ||
return geoipIplocation(BuiltinFunctionName.GEOIP.getName()); | ||
} | ||
|
||
private DefaultFunctionResolver iplocation() { | ||
return geoipIplocation(BuiltinFunctionName.IPLOCATION.getName()); | ||
} | ||
} |
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