From e5de4be0a9a965ffa2defcbdbe0165881d1948b6 Mon Sep 17 00:00:00 2001 From: Tglman Date: Fri, 20 Dec 2024 18:14:47 +0000 Subject: [PATCH] refactor: minor change of function call with method --- .../orient/core/sql/functions/OSQLFunctionFiltered.java | 5 +++-- .../sql/functions/graph/OSQLFunctionMoveFiltered.java | 3 ++- .../orient/core/sql/parser/OMethodCall.java | 9 +-------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java index ffd65b1a1fe..3991f3d8c95 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java @@ -22,6 +22,7 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.db.record.OIdentifiable; +import com.orientechnologies.orient.core.sql.executor.OResult; /** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ public interface OSQLFunctionFiltered extends OSQLFunction { @@ -30,7 +31,7 @@ public interface OSQLFunctionFiltered extends OSQLFunction { * Process a record. * * @param iThis - * @param iCurrentRecord : current record + * @param current : current record * @param iCurrentResult TODO * @param iParams : function parameters, number is ensured to be within minParams and maxParams. * @param iPossibleResults : a set of possible results (the function will return, as a result, @@ -41,7 +42,7 @@ public interface OSQLFunctionFiltered extends OSQLFunction { */ public Object execute( Object iThis, - OIdentifiable iCurrentRecord, + OResult current, Object iCurrentResult, Object[] iParams, Iterable iPossibleResults, diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionMoveFiltered.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionMoveFiltered.java index 0992f72c031..1ecb1fdad21 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionMoveFiltered.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionMoveFiltered.java @@ -7,6 +7,7 @@ import com.orientechnologies.orient.core.db.ODatabaseSession; import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.sql.OSQLEngine; +import com.orientechnologies.orient.core.sql.executor.OResult; import com.orientechnologies.orient.core.sql.functions.OSQLFunctionFiltered; /** Created by luigidellaquila on 03/01/17. */ @@ -26,7 +27,7 @@ public OSQLFunctionMoveFiltered(final String iName, final int iMin, final int iM @Override public Object execute( final Object iThis, - final OIdentifiable iCurrentRecord, + final OResult current, final Object iCurrentResult, final Object[] iParameters, final Iterable iPossibleResults, diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java index dad5ff73311..1e843dd0b72 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java @@ -160,15 +160,8 @@ private static Object invokeGraphFunction( List paramValues) { if (graphFunction instanceof OSQLFunctionFiltered) { OResult current = ctx.getCurrent(); - OIdentifiable currentR = ((OResult) current).getElement().orElse(null); return ((OSQLFunctionFiltered) graphFunction) - .execute( - targetObjects, - (OIdentifiable) currentR, - null, - paramValues.toArray(), - iPossibleResults, - ctx); + .execute(targetObjects, current, null, paramValues.toArray(), iPossibleResults, ctx); } else { OResult current = ctx.getCurrent(); if (current != null) {