Examples of SetType


Examples of io.crate.types.SetType

    public void testWhereReferenceInStringList() throws Exception {
        // where name in ("alpha", "bravo", "charlie")
        Reference ref = name_ref;
        FunctionImplementation inListImpl = functions.get(
                new FunctionIdent(InOperator.NAME,
                Arrays.<DataType>asList(DataTypes.STRING, new SetType(DataTypes.STRING))
        ));

        ImmutableSet<BytesRef> list = ImmutableSet.of(
                new BytesRef("alpha"), new BytesRef("bravo"), new BytesRef("charlie"));
        Literal set = Literal.newLiteral(new SetType(DataTypes.STRING), list);
        Function inList = new Function(inListImpl.info(), Arrays.<Symbol>asList(ref, set));

        BytesReference reference = generator.convert(new WhereClause(inList));
        Tuple<XContentType, Map<String, Object>> actualMap =
                XContentHelper.convertToMap(reference, true);
View Full Code Here

Examples of io.crate.types.SetType

    public static void register(ScalarFunctionModule mod) {
        for (DataType t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
            mod.register(
                    new CollectionAverageFunction(
                            new FunctionInfo(new FunctionIdent(
                                    NAME, ImmutableList.<DataType>of(new SetType(t))), DataTypes.DOUBLE))
            );
        }
    }
View Full Code Here

Examples of io.crate.types.SetType

    private final FunctionInfo info;

    public static void register(AggregationImplModule mod) {
        for (final DataType dataType : DataTypes.PRIMITIVE_TYPES) {
            final Streamer<?> setStreamer = new SetType(dataType).streamer();

            mod.register(
                    new CollectSetAggregation(
                            new FunctionInfo(new FunctionIdent(NAME,
                                    ImmutableList.of(dataType)),
View Full Code Here

Examples of mondrian.olap.type.SetType

              }
            }
          }
          else if (parameterType instanceof SetType)
          {
            final SetType setType = (SetType) parameterType;
            final Hierarchy hierarchy = setType.getHierarchy();
            if (parameterValue instanceof String)
            {
              final String rawString = (String) parameterValue;
              final String[] memberStr = rawString.replaceFirst("^ *\\{", "").replaceFirst("} *$", "").split(",");
              final List<Member> list = new ArrayList<Member>(memberStr.length);
View Full Code Here

Examples of mondrian.olap.type.SetType

          }
        }
      }
      else if (parameterType instanceof SetType)
      {
        final SetType setType = (SetType) parameterType;
        final Hierarchy hierarchy = setType.getHierarchy();
        if (parameterValue instanceof String)
        {
          final String rawString = (String) parameterValue;
          final String[] memberStr = rawString.replaceFirst("^ *\\{", "").replaceFirst("} *$", "").split(",");
          final List<Member> list = new ArrayList<Member>(memberStr.length);
View Full Code Here

Examples of mondrian.olap.type.SetType

            // With no args, the default implementation cannot
            // guess the hierarchy.
            RolapHierarchy defaultTimeHierarchy =
                ((RolapCube) validator.getQuery().getCube()).getTimeHierarchy(
                    getName());
            return new SetType(MemberType.forHierarchy(defaultTimeHierarchy));
        }
        final Type type = args[0].getType();
        if (type.getDimension().getDimensionType()
            != DimensionType.TimeDimension)
        {
View Full Code Here

Examples of mondrian.olap.type.SetType

        protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) {
            if (args.length == 1) {
                Exp arg = args[0];
                final Type type1 = arg.getType();
                if (type1 instanceof SetType) {
                    SetType type = (SetType) type1;
                    if (type.getElementType() instanceof MemberType) {
                        return instance;
                    } else {
                        throw newEvalException(
                            instance,
                            "Only single dimension members allowed in set for AddCalculatedMembers");
View Full Code Here

Examples of mondrian.olap.type.SetType

            // If Member is not specified,
            // it is Time.CurrentMember.
            RolapHierarchy defaultTimeHierarchy =
                ((RolapCube) validator.getQuery().getCube()).getTimeHierarchy(
                    getName());
            return new SetType(MemberType.forHierarchy(defaultTimeHierarchy));
        } else {
            Type type = args[1].getType();
            Type memberType =
            TypeUtil.toMemberOrTupleType(type);
            return new SetType(memberType);
        }
    }
View Full Code Here

Examples of org.apache.cassandra.db.marshal.SetType

                    outputCollection.addAll((Collection) listType.compose(valueByteBuffer));
                }

                else if (((Field) attribute.getJavaMember()).getType().isAssignableFrom(Set.class))
                {
                    SetType setType = SetType.getInstance((AbstractType) valueClassInstance);
                    outputCollection = new HashSet();
                    outputCollection.addAll((Collection) setType.compose(valueByteBuffer));
                }

                PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(),
                        marshalCollection(valueValidationClass, outputCollection, genericClass));
            }
View Full Code Here

Examples of org.apache.cassandra.db.marshal.SetType

            Object valueClassInstance;
            try
            {
                valueClassInstance = valueValidationClass.getDeclaredField("instance").get(null);
                SetType setType = SetType.getInstance((AbstractType) valueClassInstance);
                return setType.decompose((Set) value).array();
            }
            catch (NoSuchFieldException e)
            {
                log.error("Error while retrieving field{} value via CQL, Caused by: .", clazz.getSimpleName(), e);
                throw new PersistenceException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.