@Override
    public Object visitNull_check(@NotNull SiddhiQLParser.Null_checkContext ctx) {

        Expression expression;

        if (ctx.stream_reference() != null) {
            StreamReference streamReference = (StreamReference) visit(ctx.stream_reference());
            if (streamReference.isInnerStream) {   //InnerStream
                if (streamReference.streamIndex != null) {
                    expression = Expression.isNullInnerStream(streamReference.streamId, streamReference.streamIndex);
                } else {
                    expression = Expression.isNullInnerStream(streamReference.streamId);
                }
            } else {
                if (!streamReference.isFaultStream && activeStreams.contains(streamReference.streamId)) { //Stream
                    if (streamReference.streamIndex != null) {
                        expression = Expression.isNullStream(streamReference.streamId, streamReference.streamIndex);
                    } else {
                        expression = Expression.isNullStream(streamReference.streamId);
                    }
                } else if (streamReference.isFaultStream && activeStreams.contains(SiddhiConstants.FAULT_STREAM_FLAG
                        + streamReference.streamId)) {  //FaultStream
                    if (streamReference.streamIndex != null) {
                        expression = Expression.isNullFaultStream(streamReference.streamId,
                                streamReference.streamIndex);
                    } else {
                        expression = Expression.isNullFaultStream(streamReference.streamId);
                    }
                } else { //Attribute
                    expression = Expression.isNull(Expression.variable(streamReference.streamId));
                }
            }
        } else if (ctx.function_operation() != null) {
            expression = Expression.isNull((Expression) visit(ctx.function_operation()));
        } else { //attribute_reference
            expression = Expression.isNull((Expression) visit(ctx.attribute_reference()));
        }
        populateQueryContext(expression, ctx);
        return expression;
    }
{@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