Kuzu::

QuerySummary class

Kùzu query summary class

Public Class Methods

Kuzu::QuerySummary.from_result( result ) → query_summary

Return a Kuzu::QuerySummary from a Kuzu::QueryResult.

static VALUE
rkuzu_query_summary_s_from_result( VALUE klass, VALUE query_result )
{
        rkuzu_query_result *result = rkuzu_get_result( query_result );

        kuzu_query_summary *query_summary = ALLOC( kuzu_query_summary );
        VALUE query_summary_obj = rb_class_new_instance( 0, 0, klass );

        /*
                TODO Release the GIL
        */
        if ( kuzu_query_result_get_query_summary(&result->result, query_summary) != KuzuSuccess ) {
                xfree( query_summary );
                query_summary = NULL;
                rb_raise( rkuzu_eQueryError, "Could not fetch the query summary." );
        }

        DEBUG_GC( ">>> allocated query summary %p\n", query_summary );
        RTYPEDDATA_DATA( query_summary_obj ) = query_summary;

        return query_summary_obj;
}

Public Instance Methods

compiling_time → float

Returns the compilation time of the given query summary in milliseconds.

static VALUE
rkuzu_query_summary_compiling_time( VALUE self )
{
        kuzu_query_summary *summary = CHECK_QUERY_SUMMARY( self );
        double result = kuzu_query_summary_get_compiling_time( summary );

        return rb_float_new( result );
}
execution_time → float

Returns the execution time of the given query summary in milliseconds.

static VALUE
rkuzu_query_summary_execution_time( VALUE self )
{
        kuzu_query_summary *summary = CHECK_QUERY_SUMMARY( self );
        double result = kuzu_query_summary_get_execution_time( summary );

        return rb_float_new( result );
}
inspect()

Return a string representation of the receiver suitable for debugging.

# File lib/kuzu/query_summary.rb, line 17
def inspect
        details = " compiling: %0.3fs  execution: %0.3fs" % [
                self.compiling_time,
                self.execution_time,
        ]

        default = super
        return default.sub( />/, details + '>' )
end