@Override
    public StreamDefinition visitDefinition_stream(@NotNull SiddhiQLParser.Definition_streamContext ctx) {

        Source source = (Source) visit(ctx.source());
        if (source.isInnerStream) {
            throw newSiddhiParserException(ctx, " InnerStreams cannot be defined!");
        }
        if (source.isFaultStream) {
            throw newSiddhiParserException(ctx, " FaultStreams cannot be explicitly defined!");
        }
        try {
            StreamDefinition streamDefinition = StreamDefinition.id(source.streamId);
            populateQueryContext(streamDefinition, ctx);
            List<SiddhiQLParser.Attribute_nameContext> attribute_names = ctx.attribute_name();
            List<SiddhiQLParser.Attribute_typeContext> attribute_types = ctx.attribute_type();
            for (int i = 0; i < attribute_names.size(); i++) {
                SiddhiQLParser.Attribute_nameContext attributeNameContext = attribute_names.get(i);
                SiddhiQLParser.Attribute_typeContext attributeTypeContext = attribute_types.get(i);
                streamDefinition.attribute((String) visit(attributeNameContext), (Attribute.Type) visit
                        (attributeTypeContext));

            }
            for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) {
                streamDefinition.annotation((Annotation) visit(annotationContext));
            }
            return streamDefinition;
        } catch (Throwable t) {
            throw newSiddhiParserException(ctx, t.getMessage(), t);
        }
    }
{@inheritDoc}
<p>The default implementation returns the result of calling
{@link #visitChildren} on {@code ctx}.</p>

@param ctx
modules/siddhi-query-compiler/src/main/java/io/siddhi/query/compiler/internal/SiddhiQLBaseVisitorImpl.java