public void validate(ClientState state) throws InvalidRequestException { UDFunction.assertUdfsEnabled(language); if (ifNotExists && orReplace) throw new InvalidRequestException("Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives"); if (Schema.instance.getKSMetaData(functionName.keyspace) == null) throw new InvalidRequestException(String.format("Cannot add function '%s' to non existing keyspace '%s'.", functionName.name, functionName.keyspace)); }
public void validate(ClientState state) throws InvalidRequestException { UDFunction.assertUdfsEnabled(language); if (ifNotExists && orReplace) throw new InvalidRequestException("Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives"); if (Schema.instance.getKSMetaData(functionName.keyspace) == null) throw new InvalidRequestException(String.format("Cannot add function '%s' to non existing keyspace '%s'.", functionName.name, functionName.keyspace)); }
public void validate(ClientState state) throws InvalidRequestException { UDFunction.assertUdfsEnabled(language); if (ifNotExists && orReplace) throw new InvalidRequestException("Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives"); if (Schema.instance.getKSMetaData(functionName.keyspace) == null) throw new InvalidRequestException(String.format("Cannot add function '%s' to non existing keyspace '%s'.", functionName.name, functionName.keyspace)); }
public static UDFunction create(FunctionName name, List<ColumnIdentifier> argNames, List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, String language, String body) { UDFunction.assertUdfsEnabled(language); switch (language) { case "java": return new JavaBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, body); default: return new ScriptBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, language, body); } }
public static UDFunction create(FunctionName name, List<ColumnIdentifier> argNames, List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, String language, String body) { UDFunction.assertUdfsEnabled(language); switch (language) { case "java": return new JavaBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, body); default: return new ScriptBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, language, body); } }
public static UDFunction create(FunctionName name, List<ColumnIdentifier> argNames, List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, String language, String body) { UDFunction.assertUdfsEnabled(language); switch (language) { case "java": return new JavaBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, body); default: return new ScriptBasedUDFunction(name, argNames, argTypes, returnType, calledOnNullInput, language, body); } }
public final ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assertUdfsEnabled(language); if (!isCallableWrtNullable(parameters)) return null; long tStart = System.nanoTime(); parameters = makeEmptyParametersNull(parameters); try { // Using async UDF execution is expensive (adds about 100us overhead per invocation on a Core-i7 MBPr). ByteBuffer result = DatabaseDescriptor.enableUserDefinedFunctionsThreads() ? executeAsync(protocolVersion, parameters) : executeUserDefined(protocolVersion, parameters); Tracing.trace("Executed UDF {} in {}\u03bcs", name(), (System.nanoTime() - tStart) / 1000); return result; } catch (InvalidRequestException e) { throw e; } catch (Throwable t) { logger.trace("Invocation of user-defined function '{}' failed", this, t); if (t instanceof VirtualMachineError) throw (VirtualMachineError) t; throw FunctionExecutionException.create(this, t); } }
public final ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assertUdfsEnabled(language); if (!isCallableWrtNullable(parameters)) return null; long tStart = System.nanoTime(); parameters = makeEmptyParametersNull(parameters); try { // Using async UDF execution is expensive (adds about 100us overhead per invocation on a Core-i7 MBPr). ByteBuffer result = DatabaseDescriptor.enableUserDefinedFunctionsThreads() ? executeAsync(protocolVersion, parameters) : executeUserDefined(protocolVersion, parameters); Tracing.trace("Executed UDF {} in {}\u03bcs", name(), (System.nanoTime() - tStart) / 1000); return result; } catch (InvalidRequestException e) { throw e; } catch (Throwable t) { logger.trace("Invocation of user-defined function '{}' failed", this, t); if (t instanceof VirtualMachineError) throw (VirtualMachineError) t; throw FunctionExecutionException.create(this, t); } }
public final ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assertUdfsEnabled(language); if (!isCallableWrtNullable(parameters)) return null; long tStart = System.nanoTime(); parameters = makeEmptyParametersNull(parameters); try { // Using async UDF execution is expensive (adds about 100us overhead per invocation on a Core-i7 MBPr). ByteBuffer result = DatabaseDescriptor.enableUserDefinedFunctionsThreads() ? executeAsync(protocolVersion, parameters) : executeUserDefined(protocolVersion, parameters); Tracing.trace("Executed UDF {} in {}\u03bcs", name(), (System.nanoTime() - tStart) / 1000); return result; } catch (InvalidRequestException e) { throw e; } catch (Throwable t) { logger.trace("Invocation of user-defined function '{}' failed", this, t); if (t instanceof VirtualMachineError) throw (VirtualMachineError) t; throw FunctionExecutionException.create(this, t); } }