Skip to content

Commit

Permalink
GIS #462: added first basic function into SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
danylokravchenko committed Nov 8, 2023
1 parent ceb7dc8 commit 02edd62
Show file tree
Hide file tree
Showing 18 changed files with 1,001 additions and 772 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.polypheny.db.algebra.constant.FunctionCategory.Property.DISTANCE_FUNCTION;
import static org.polypheny.db.algebra.constant.FunctionCategory.Property.FUNCTION;
import static org.polypheny.db.algebra.constant.FunctionCategory.Property.GEO_FUNCTION;
import static org.polypheny.db.algebra.constant.FunctionCategory.Property.MULTIMEDIA_FUNCTION;
import static org.polypheny.db.algebra.constant.FunctionCategory.Property.SPECIFIC;
import static org.polypheny.db.algebra.constant.FunctionCategory.Property.TABLE_FUNCTION;
Expand All @@ -44,7 +45,8 @@ public enum FunctionCategory {
USER_DEFINED_TABLE_SPECIFIC_FUNCTION( "TABLE_UDF_SPECIFIC", "User-defined table function with SPECIFIC name", USER_DEFINED, TABLE_FUNCTION, SPECIFIC ),
MATCH_RECOGNIZE( "MATCH_RECOGNIZE", "MATCH_RECOGNIZE function", TABLE_FUNCTION ),
DISTANCE( "DISTANCE", "distance function", DISTANCE_FUNCTION ),
MULTIMEDIA( "MULTIMEDIA", "Multimedia function", MULTIMEDIA_FUNCTION );
MULTIMEDIA( "MULTIMEDIA", "Multimedia function", MULTIMEDIA_FUNCTION ),
GEOMETRY( "GEOMETRY", "Geo function", GEO_FUNCTION );

private final EnumSet<Property> properties;

Expand Down Expand Up @@ -97,7 +99,7 @@ public boolean isUserDefinedNotSpecificFunction() {
* Property of a SqlFunctionCategory.
*/
enum Property {
USER_DEFINED, TABLE_FUNCTION, SPECIFIC, FUNCTION, DISTANCE_FUNCTION, MULTIMEDIA_FUNCTION
USER_DEFINED, TABLE_FUNCTION, SPECIFIC, FUNCTION, DISTANCE_FUNCTION, MULTIMEDIA_FUNCTION, GEO_FUNCTION
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ public Expression implement( RexToLixTranslator translator, RexCall call, List<E
winAggMap.put( OperatorRegistry.getAgg( OperatorName.NTILE ), constructorSupplier( NtileImplementor.class ) );
winAggMap.put( OperatorRegistry.getAgg( OperatorName.COUNT ), constructorSupplier( CountWinImplementor.class ) );
winAggMap.put( OperatorRegistry.getAgg( OperatorName.REGR_COUNT ), constructorSupplier( CountWinImplementor.class ) );

// geo functions
defineMethod( OperatorRegistry.get( OperatorName.ST_GEOFROMTEXT ), BuiltInMethod.ST_GEO_FROM_TEXT.method, NullPolicy.STRICT );
defineMethod( OperatorRegistry.get( OperatorName.ST_X ), BuiltInMethod.ST_X.method, NullPolicy.STRICT );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,13 @@ public enum OperatorName {

UNWRAP_INTERVAL( LangFunctionOperator.class ),

//-------------------------------------------------------------
// GEO OPERATORS
//-------------------------------------------------------------

ST_GEOFROMTEXT( Function.class ),
ST_X( Function.class ),

//-------------------------------------------------------------
// SET OPERATORS
//-------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3979,7 +3979,7 @@ public static PolyDictionary deserializeDirectory( String parsed ) {
}


private static RuntimeException toUnchecked( Exception e ) {
static RuntimeException toUnchecked( Exception e ) {
if ( e instanceof RuntimeException ) {
return (RuntimeException) e;
}
Expand Down
Loading

0 comments on commit 02edd62

Please sign in to comment.