Codota Logo
ScalarFunction.testAssignment
Code IndexAdd Codota to your IDE (free)

How to use
testAssignment
method
in
org.apache.cassandra.cql3.functions.ScalarFunction

Best Java code snippets using org.apache.cassandra.cql3.functions.ScalarFunction.testAssignment (Showing top 3 results out of 315)

  • Common ways to obtain ScalarFunction
private void myMethod () {
ScalarFunction s =
  • Codota IconOptional optional;(ScalarFunction) optional.get()
  • Smart code suggestions by Codota
}
origin: jsevellec/cassandra-unit

public Term prepare(String keyspace, ColumnSpecification receiver) throws InvalidRequestException
{
  Function fun = FunctionResolver.get(keyspace, name, terms, receiver.ksName, receiver.cfName, receiver.type);
  if (fun == null)
    throw new InvalidRequestException(String.format("Unknown function %s called", name));
  if (fun.isAggregate())
    throw new InvalidRequestException("Aggregation function are not supported in the where clause");
  ScalarFunction scalarFun = (ScalarFunction) fun;
  // Functions.get() will complain if no function "name" type check with the provided arguments.
  // We still have to validate that the return type matches however
  if (!scalarFun.testAssignment(keyspace, receiver).isAssignable())
    throw new InvalidRequestException(String.format("Type error: cannot assign result of function %s (type %s) to %s (type %s)",
                            scalarFun.name(), scalarFun.returnType().asCQL3Type(),
                            receiver.name, receiver.type.asCQL3Type()));
  if (fun.argTypes().size() != terms.size())
    throw new InvalidRequestException(String.format("Incorrect number of arguments specified for function %s (expected %d, found %d)",
                            fun, fun.argTypes().size(), terms.size()));
  List<Term> parameters = new ArrayList<>(terms.size());
  for (int i = 0; i < terms.size(); i++)
  {
    Term t = terms.get(i).prepare(keyspace, FunctionResolver.makeArgSpec(receiver.ksName, receiver.cfName, scalarFun, i));
    parameters.add(t);
  }
  return new FunctionCall(scalarFun, parameters);
}
origin: org.apache.cassandra/cassandra-all

public Term prepare(String keyspace, ColumnSpecification receiver) throws InvalidRequestException
{
  Function fun = FunctionResolver.get(keyspace, name, terms, receiver.ksName, receiver.cfName, receiver.type);
  if (fun == null)
    throw new InvalidRequestException(String.format("Unknown function %s called", name));
  if (fun.isAggregate())
    throw new InvalidRequestException("Aggregation function are not supported in the where clause");
  ScalarFunction scalarFun = (ScalarFunction) fun;
  // Functions.get() will complain if no function "name" type check with the provided arguments.
  // We still have to validate that the return type matches however
  if (!scalarFun.testAssignment(keyspace, receiver).isAssignable())
    throw new InvalidRequestException(String.format("Type error: cannot assign result of function %s (type %s) to %s (type %s)",
                            scalarFun.name(), scalarFun.returnType().asCQL3Type(),
                            receiver.name, receiver.type.asCQL3Type()));
  if (fun.argTypes().size() != terms.size())
    throw new InvalidRequestException(String.format("Incorrect number of arguments specified for function %s (expected %d, found %d)",
                            fun, fun.argTypes().size(), terms.size()));
  List<Term> parameters = new ArrayList<>(terms.size());
  for (int i = 0; i < terms.size(); i++)
  {
    Term t = terms.get(i).prepare(keyspace, FunctionResolver.makeArgSpec(receiver.ksName, receiver.cfName, scalarFun, i));
    parameters.add(t);
  }
  return new FunctionCall(scalarFun, parameters);
}
origin: com.strapdata.cassandra/cassandra-all

public Term prepare(String keyspace, ColumnSpecification receiver) throws InvalidRequestException
{
  Function fun = FunctionResolver.get(keyspace, name, terms, receiver.ksName, receiver.cfName, receiver.type);
  if (fun == null)
    throw new InvalidRequestException(String.format("Unknown function %s called", name));
  if (fun.isAggregate())
    throw new InvalidRequestException("Aggregation function are not supported in the where clause");
  ScalarFunction scalarFun = (ScalarFunction) fun;
  // Functions.get() will complain if no function "name" type check with the provided arguments.
  // We still have to validate that the return type matches however
  if (!scalarFun.testAssignment(keyspace, receiver).isAssignable())
    throw new InvalidRequestException(String.format("Type error: cannot assign result of function %s (type %s) to %s (type %s)",
                            scalarFun.name(), scalarFun.returnType().asCQL3Type(),
                            receiver.name, receiver.type.asCQL3Type()));
  if (fun.argTypes().size() != terms.size())
    throw new InvalidRequestException(String.format("Incorrect number of arguments specified for function %s (expected %d, found %d)",
                            fun, fun.argTypes().size(), terms.size()));
  List<Term> parameters = new ArrayList<>(terms.size());
  for (int i = 0; i < terms.size(); i++)
  {
    Term t = terms.get(i).prepare(keyspace, FunctionResolver.makeArgSpec(receiver.ksName, receiver.cfName, scalarFun, i));
    parameters.add(t);
  }
  return new FunctionCall(scalarFun, parameters);
}
org.apache.cassandra.cql3.functionsScalarFunctiontestAssignment

Popular methods of ScalarFunction

  • addFunctionsTo
  • execute
    Applies this function to the specified parameter.
  • isCalledOnNullInput
  • name
  • returnType

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JTable (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now