Table of Contents

Class VelocityDataBlockExtensions

Namespace
Datafication.Storage.Velocity
Assembly
Datafication.Storage.Velocity.dll

Extension methods for VelocityDataBlock providing convenient operations.

public static class VelocityDataBlockExtensions
Inheritance
object
VelocityDataBlockExtensions

Methods

Any(VelocityDataBlock)

Checks if any rows exist matching the current query plan.

public static bool Any(this VelocityDataBlock vdb)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock with pending query operations.

Returns

bool

True if any rows match, false otherwise.

Remarks

This method uses lazy evaluation and may short-circuit early for better performance than counting all rows.

Any(VelocityDataBlock, string, object)

Checks if any rows exist where the specified column equals the given value.

public static bool Any(this VelocityDataBlock vdb, string column, object value)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock to query.

column string

The column to filter on.

value object

The value to compare against.

Returns

bool

True if any rows match, false otherwise.

Any(VelocityDataBlock, string, object, ComparisonOperator)

Checks if any rows exist matching the specified condition.

public static bool Any(this VelocityDataBlock vdb, string column, object value, ComparisonOperator op)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock to query.

column string

The column to filter on.

value object

The value to compare against.

op ComparisonOperator

The comparison operator to use.

Returns

bool

True if any rows match, false otherwise.

Count(VelocityDataBlock)

Returns the count of rows matching the current query plan without full materialization.

public static int Count(this VelocityDataBlock vdb)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock with pending query operations.

Returns

int

The number of matching rows.

Examples

// Count matching rows without materializing data
int count = vdb.Where("Country", "USA").Count();

// This is equivalent to but much faster than:
int countSlow = vdb.Where("Country", "USA").Execute().RowCount;

Remarks

This method uses lazy evaluation via AsResult() to count rows efficiently. For bitmask-based queries, this uses SIMD PopCount for ~50-100x faster performance than full materialization.

Count(VelocityDataBlock, string, object)

Returns the count of rows where the specified column equals the given value.

public static int Count(this VelocityDataBlock vdb, string column, object value)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock to query.

column string

The column to filter on.

value object

The value to compare against.

Returns

int

The number of matching rows.

Examples

// Count rows where Country is USA
int usaCount = vdb.Count("Country", "USA");

// This is equivalent to:
int usaCount = vdb.Where("Country", "USA").AsResult().RowCount;

Remarks

This is a convenience method that combines Where and Count operations. Uses lazy evaluation for maximum performance.

Count(VelocityDataBlock, string, object, ComparisonOperator)

Returns the count of rows matching the specified condition.

public static int Count(this VelocityDataBlock vdb, string column, object value, ComparisonOperator op)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock to query.

column string

The column to filter on.

value object

The value to compare against.

op ComparisonOperator

The comparison operator to use.

Returns

int

The number of matching rows.

Examples

// Count rows where Age > 25
int count = vdb.Count("Age", 25, ComparisonOperator.GreaterThan);

Remarks

This is a convenience method that combines Where and Count operations. Uses lazy evaluation for maximum performance.

FirstOrDefault(VelocityDataBlock)

Gets the first row matching the current query plan, or null if no rows match.

public static VelocityDataRow? FirstOrDefault(this VelocityDataBlock vdb)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock with pending query operations.

Returns

VelocityDataRow

The first matching row as a VelocityDataRow, or null.

Remarks

This method is optimized to only read the first row's data, avoiding full materialization.

FirstOrDefault(VelocityDataBlock, string, object)

Gets the first row where the specified column equals the given value, or null if no rows match.

public static VelocityDataRow? FirstOrDefault(this VelocityDataBlock vdb, string column, object value)

Parameters

vdb VelocityDataBlock

The VelocityDataBlock to query.

column string

The column to filter on.

value object

The value to compare against.

Returns

VelocityDataRow

The first matching row as a VelocityDataRow, or null.