public CastFunction(AbstractType<I> inputType, AbstractType<O> outputType) { super(getFunctionName(outputType), outputType, inputType); }
public CastFunction(AbstractType<I> inputType, AbstractType<O> outputType) { super(getFunctionName(outputType), outputType, inputType); }
public CastFunction(AbstractType<I> inputType, AbstractType<O> outputType) { super(getFunctionName(outputType), outputType, inputType); }
/** * Creates the name of the cast function use to cast to the specified type. * * @param outputType the output type * @return the name of the cast function use to cast to the specified type */ public static String getFunctionName(AbstractType<?> outputType) { return getFunctionName(outputType.asCQL3Type()); }
/** * Creates the name of the cast function use to cast to the specified type. * * @param outputType the output type * @return the name of the cast function use to cast to the specified type */ public static String getFunctionName(AbstractType<?> outputType) { return getFunctionName(outputType.asCQL3Type()); }
/** * Creates the name of the cast function use to cast to the specified type. * * @param outputType the output type * @return the name of the cast function use to cast to the specified type */ public static String getFunctionName(AbstractType<?> outputType) { return getFunctionName(outputType.asCQL3Type()); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }