Skip to content

Commit

Permalink
Deprecate runtime=compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Oct 9, 2018
1 parent 917c9bc commit da35bc7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 15 deletions.
Expand Up @@ -24,25 +24,19 @@

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

import org.neo4j.graphdb.InputPosition;
import org.neo4j.graphdb.Notification;
import org.neo4j.graphdb.QueryExecutionException;
import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.SeverityLevel;
import org.neo4j.graphdb.Transaction;
import org.neo4j.kernel.impl.proc.Procedures;
import org.neo4j.procedure.Procedure;

import static org.hamcrest.Matchers.any;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.neo4j.graphdb.impl.notification.NotificationCode.CREATE_UNIQUE_UNAVAILABLE_FALLBACK;
import static org.neo4j.graphdb.impl.notification.NotificationCode.DEPRECATED_PLANNER;

public class DeprecationAcceptanceTest extends NotificationTestSupport
{
Expand All @@ -56,7 +50,19 @@ public void deprecatedRulePlanner()
InputPosition position = InputPosition.empty;

// then
assertThat( result.getNotifications(), containsItem( deprecatedPlanner ) );
assertThat( result.getNotifications(), containsItem( deprecatedRulePlanner ) );
result.close();
}

@Test
public void deprecatedCompiledRuntime()
{
// when
Result result = db().execute( "CYPHER runtime=compiled RETURN 1" );
InputPosition position = InputPosition.empty;

// then
assertThat( result.getNotifications(), containsItem( deprecatedCompiledRuntime ) );
result.close();
}

Expand Down Expand Up @@ -284,10 +290,14 @@ public Stream<ChangedResults> changedProc()
notification( "Neo.ClientNotification.Statement.FeatureDeprecationWarning", containsString( "The query used a deprecated function." ),
any( InputPosition.class ), SeverityLevel.WARNING );

private Matcher<Notification> deprecatedPlanner =
private Matcher<Notification> deprecatedRulePlanner =
notification( "Neo.ClientNotification.Statement.FeatureDeprecationWarning", containsString( "The rule planner, which was used to plan this query, is deprecated and will be discontinued soon. If you did not explicitly choose the rule planner, you should try to change your query so that the rule planner is not used" ),
any( InputPosition.class ), SeverityLevel.WARNING );

private Matcher<Notification> deprecatedCompiledRuntime =
notification( "Neo.ClientNotification.Statement.FeatureDeprecationWarning", containsString( "The compiled runtime, which was requested to execute this query, is deprecated and will be removed in a future release." ),
any( InputPosition.class ), SeverityLevel.WARNING );

private Matcher<Notification> deprecatedStartWarning = notification( "Neo.ClientNotification.Statement.FeatureDeprecationWarning",
containsString( "START has been deprecated and will be removed in a future version. " ), any( InputPosition.class ), SeverityLevel.WARNING );

Expand Down
Expand Up @@ -63,6 +63,8 @@ case class ProcedureWarningNotification(position: InputPosition, procedure: Stri

case class DeprecatedFieldNotification(position: InputPosition, procedure: String, field: String) extends InternalNotification

case object DeprecatedPlannerNotification extends InternalNotification
case object DeprecatedRulePlannerNotification extends InternalNotification

case object DeprecatedCompiledRuntimeNotification extends InternalNotification

case class ExperimentalFeatureNotification(msg: String) extends InternalNotification
Expand Up @@ -141,7 +141,10 @@ class MasterCompiler(graph: GraphDatabaseQueryService,
}

if (preParsedQuery.planner == CypherPlannerOption.rule)
logger.log(DeprecatedPlannerNotification)
logger.log(DeprecatedRulePlannerNotification)

if (preParsedQuery.runtime == CypherRuntimeOption.compiled)
logger.log(DeprecatedCompiledRuntimeNotification)

// Do the compilation
innerCompile(preParsedQuery, params)
Expand Down
Expand Up @@ -251,7 +251,7 @@ object ExecutionResultWrapper {
case DeprecatedProcedureNotification(pos, oldName, newName) =>
NotificationCode.DEPRECATED_PROCEDURE.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.deprecatedName(oldName, newName))
case DeprecatedPlannerNotification =>
NotificationCode.DEPRECATED_PLANNER.notification(graphdb.InputPosition.empty)
NotificationCode.DEPRECATED_RULE_PLANNER.notification(graphdb.InputPosition.empty)
}

private implicit class ConvertibleCompilerInputPosition(pos: frontend.v3_1.InputPosition) {
Expand Down
Expand Up @@ -150,7 +150,7 @@ object helpers {
case nfV3_4.DeprecatedFieldNotification(position, procedure, field) => compilerv3_5.DeprecatedFieldNotification(as3_5(position), procedure, field)
case nfV3_4.DeprecatedVarLengthBindingNotification(position, variable) => nfv3_5.DeprecatedVarLengthBindingNotification(as3_5(position), variable)
case nfV3_4.DeprecatedRelTypeSeparatorNotification(position) => nfv3_5.DeprecatedRelTypeSeparatorNotification(as3_5(position))
case nfV3_4.DeprecatedPlannerNotification => compilerv3_5.DeprecatedPlannerNotification
case nfV3_4.DeprecatedPlannerNotification => compilerv3_5.DeprecatedRulePlannerNotification
case nfV3_4.ExperimentalFeatureNotification(msg) => compilerv3_5.ExperimentalFeatureNotification(msg)
case nfV3_4.SuboptimalIndexForContainsQueryNotification(label, propertyKeys) => compilerv3_5.SuboptimalIndexForConstainsQueryNotification(label, propertyKeys)
case nfV3_4.SuboptimalIndexForEndsWithQueryNotification(label, propertyKeys) => compilerv3_5.SuboptimalIndexForEndsWithQueryNotification(label, propertyKeys)
Expand Down
Expand Up @@ -79,8 +79,10 @@ object InternalWrapping {
NotificationCode.DEPRECATED_BINDING_VAR_LENGTH_RELATIONSHIP.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.bindingVarLengthRelationship(variable))
case DeprecatedRelTypeSeparatorNotification(pos) =>
NotificationCode.DEPRECATED_RELATIONSHIP_TYPE_SEPARATOR.notification(pos.withOffset(offset).asInputPosition)
case DeprecatedPlannerNotification =>
NotificationCode.DEPRECATED_PLANNER.notification(graphdb.InputPosition.empty)
case DeprecatedRulePlannerNotification =>
NotificationCode.DEPRECATED_RULE_PLANNER.notification(graphdb.InputPosition.empty)
case DeprecatedCompiledRuntimeNotification =>
NotificationCode.DEPRECATED_COMPILED_RUNTIME.notification(graphdb.InputPosition.empty)
case ProcedureWarningNotification(pos, name, warning) =>
NotificationCode.PROCEDURE_WARNING.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.procedureWarning(name, warning))
case ExperimentalFeatureNotification(msg) =>
Expand Down
Expand Up @@ -46,13 +46,18 @@ public enum NotificationCode
Status.Statement.FeatureDeprecationWarning,
"Using PLANNER for switching between planners has been deprecated, please use CYPHER planner=[rule,cost] instead"
),
DEPRECATED_PLANNER(
DEPRECATED_RULE_PLANNER(
SeverityLevel.WARNING,
Status.Statement.FeatureDeprecationWarning,
"The rule planner, which was used to plan this query, is deprecated and will be discontinued soon. " +
"If you did not explicitly choose the rule planner, you should try to change your query so that the " +
"rule planner is not used"
),
DEPRECATED_COMPILED_RUNTIME(
SeverityLevel.WARNING,
Status.Statement.FeatureDeprecationWarning,
"The compiled runtime, which was requested to execute this query, is deprecated and will be removed in a future release."
),
PLANNER_UNSUPPORTED(
SeverityLevel.WARNING,
Status.Statement.PlannerUnsupportedWarning,
Expand Down

0 comments on commit da35bc7

Please sign in to comment.