public void notifyDropFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onDropFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyCreateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onCreateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyUpdateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onUpdateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyDropFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onDropFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyDropFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onDropFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyCreateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onCreateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyUpdateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onUpdateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyCreateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onCreateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public void notifyUpdateFunction(UDFunction udf) { for (MigrationListener listener : listeners) listener.onUpdateFunction(udf.name().keyspace, udf.name().name, udf.argTypes()); }
public static void announceFunctionDrop(UDFunction udf, boolean announceLocally) { logger.info("Drop scalar function overload '{}' args '{}'", udf.name(), udf.argTypes()); KeyspaceMetadata ksm = Schema.instance.getKSMetaData(udf.name().keyspace); announce(SchemaKeyspace.makeDropFunctionMutation(ksm, udf, FBUtilities.timestampMicros()), announceLocally); }
public static void announceFunctionDrop(UDFunction udf, boolean announceLocally) { logger.info("Drop scalar function overload '{}' args '{}'", udf.name(), udf.argTypes()); KeyspaceMetadata ksm = Schema.instance.getKSMetaData(udf.name().keyspace); announce(SchemaKeyspace.makeDropFunctionMutation(ksm, udf, FBUtilities.timestampMicros()), announceLocally); }
public static void announceFunctionDrop(UDFunction udf, boolean announceLocally) { logger.info("Drop scalar function overload '{}' args '{}'", udf.name(), udf.argTypes()); KeyspaceMetadata ksm = Schema.instance.getKSMetaData(udf.name().keyspace); announce(SchemaKeyspace.makeDropFunctionMutation(ksm, udf, FBUtilities.timestampMicros()), announceLocally); }
public void dropFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()))); MigrationManager.instance.notifyDropFunction(udf); }
public void dropFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()))); MigrationManager.instance.notifyDropFunction(udf); }
public void dropFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()))); MigrationManager.instance.notifyDropFunction(udf); }
public void updateFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()).with(udf))); MigrationManager.instance.notifyUpdateFunction(udf); }
public void updateFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()).with(udf))); MigrationManager.instance.notifyUpdateFunction(udf); }
public void updateFunction(UDFunction udf) { update(udf.name().keyspace, ks -> ks.withSwapped(ks.functions.without(udf.name(), udf.argTypes()).with(udf))); MigrationManager.instance.notifyUpdateFunction(udf); }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { Function old = Schema.instance.findFunction(functionName, argTypes).orElse(null); boolean replaced = old != null; if (replaced) { if (ifNotExists) return null; if (!orReplace) throw new InvalidRequestException(String.format("Function %s already exists", old)); if (!(old instanceof ScalarFunction)) throw new InvalidRequestException(String.format("Function %s can only replace a function", old)); if (calledOnNullInput != ((ScalarFunction) old).isCalledOnNullInput()) throw new InvalidRequestException(String.format("Function %s can only be replaced with %s", old, calledOnNullInput ? "CALLED ON NULL INPUT" : "RETURNS NULL ON NULL INPUT")); if (!Functions.typesMatch(old.returnType(), returnType)) throw new InvalidRequestException(String.format("Cannot replace function %s, the new return type %s is not compatible with the return type %s of existing function", functionName, returnType.asCQL3Type(), old.returnType().asCQL3Type())); } UDFunction udFunction = UDFunction.create(functionName, argNames, argTypes, returnType, calledOnNullInput, language, body); MigrationManager.announceNewFunction(udFunction, isLocalOnly); return new Event.SchemaChange(replaced ? Event.SchemaChange.Change.UPDATED : Event.SchemaChange.Change.CREATED, Event.SchemaChange.Target.FUNCTION, udFunction.name().keyspace, udFunction.name().name, AbstractType.asCQLTypeStringList(udFunction.argTypes())); }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { Function old = Schema.instance.findFunction(functionName, argTypes).orElse(null); boolean replaced = old != null; if (replaced) { if (ifNotExists) return null; if (!orReplace) throw new InvalidRequestException(String.format("Function %s already exists", old)); if (!(old instanceof ScalarFunction)) throw new InvalidRequestException(String.format("Function %s can only replace a function", old)); if (calledOnNullInput != ((ScalarFunction) old).isCalledOnNullInput()) throw new InvalidRequestException(String.format("Function %s can only be replaced with %s", old, calledOnNullInput ? "CALLED ON NULL INPUT" : "RETURNS NULL ON NULL INPUT")); if (!Functions.typesMatch(old.returnType(), returnType)) throw new InvalidRequestException(String.format("Cannot replace function %s, the new return type %s is not compatible with the return type %s of existing function", functionName, returnType.asCQL3Type(), old.returnType().asCQL3Type())); } UDFunction udFunction = UDFunction.create(functionName, argNames, argTypes, returnType, calledOnNullInput, language, body); MigrationManager.announceNewFunction(udFunction, isLocalOnly); return new Event.SchemaChange(replaced ? Event.SchemaChange.Change.UPDATED : Event.SchemaChange.Change.CREATED, Event.SchemaChange.Target.FUNCTION, udFunction.name().keyspace, udFunction.name().name, AbstractType.asCQLTypeStringList(udFunction.argTypes())); }