public IAType computeType()

in asterix-bad/src/main/java/org/apache/asterix/bad/function/rewriter/BADFeedRewriter.java [164:183]


    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env, IMetadataProvider<?, ?> mp)
            throws AlgebricksException {
        AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expression;
        if (f.getArguments().size() != BuiltinFunctions.FEED_COLLECT.getArity()) {
            throw new AlgebricksException("Incorrect number of arguments -> arity is "
                    + BuiltinFunctions.FEED_COLLECT.getArity() + ", not " + f.getArguments().size());
        }
        DataverseName dataverseName =
                DataverseName.createFromCanonicalForm(ConstantExpressionUtil.getStringArgument(f, 0));
        String outputTypeName = ConstantExpressionUtil.getStringArgument(f, 5);
        if (outputTypeName == null) {
            return BuiltinType.ANY;
        }
        MetadataProvider metadata = (MetadataProvider) mp;
        IAType outputType = metadata.findType(dataverseName, outputTypeName);
        if (outputType == null) {
            throw new AlgebricksException("Unknown type " + outputTypeName);
        }
        return outputType;
    }