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); }
/** * Returns the column specification corresponding to the output value of the selector instances created by * this factory. * * @param cfm the column family meta data * @return a column specification */ public final ColumnSpecification getColumnSpecification(CFMetaData cfm) { return new ColumnSpecification(cfm.ksName, cfm.cfName, new ColumnIdentifier(getColumnName(), true), // note that the name is not necessarily // a true column name so we shouldn't intern it getReturnType()); }
/** * Returns the column specification corresponding to the output value of the selector instances created by * this factory. * * @param cfm the column family meta data * @return a column specification */ public final ColumnSpecification getColumnSpecification(CFMetaData cfm) { return new ColumnSpecification(cfm.ksName, cfm.cfName, new ColumnIdentifier(getColumnName(), true), // note that the name is not necessarily // a true column name so we shouldn't intern it getReturnType()); }
/** * Returns the column specification corresponding to the output value of the selector instances created by * this factory. * * @param cfm the column family meta data * @return a column specification */ public final ColumnSpecification getColumnSpecification(CFMetaData cfm) { return new ColumnSpecification(cfm.ksName, cfm.cfName, new ColumnIdentifier(getColumnName(), true), // note that the name is not necessarily // a true column name so we shouldn't intern it getReturnType()); }