Module database

Module database 

Source
Expand description

Module with database related functionality. In particular, this module contains the accessor traits and the OwnedTable type along with some utility functions to convert between Arrow and OwnedTable.

Re-exports§

pub use crate::base::arrow::arrow_array_to_column_conversion::ArrayRefExt;
pub use crate::base::arrow::arrow_array_to_column_conversion::ArrowArrayToColumnConversionError;
pub use crate::base::arrow::owned_and_arrow_conversions::OwnedArrowConversionError;
pub use crate::base::arrow::scalar_and_i256_conversions;

Modules§

arrow_schema_utility
This module provides utility functions for working with Arrow schemas in the context of Proof of SQL. It includes functionality to convert Arrow schemas to PoSQL-compatible formats.
owned_table_utility
Utility functions for creating OwnedTables and OwnedColumns. These functions are primarily intended for use in tests.
table_utility
Utility functions for creating Tables and Columns. These functions are primarily intended for use in tests.

Structs§

ColumnField
This type is used to represent the metadata of a column in a table. Namely: it’s name and type.
ColumnRef
Reference of a SQL column
OwnedTable
A table of data, with schema included. This is simply a map from Ident to OwnedColumn, where columns order matters. This is primarily used as an internal result that is used before converting to the final result in either Arrow format or JSON. This is the analog of an arrow RecordBatch.
OwnedTableTestAccessor
A test accessor that uses OwnedTable as the underlying table type. Note: this is intended for testing and examples. It is not optimized for performance, so should not be used for benchmarks or production use-cases.
Table
A table of data, with schema included. This is simply a map from Ident to Column, where columns order matters. This is primarily used as an internal result that is used before converting to the final result in either Arrow format or JSON. This is the analog of an arrow RecordBatch.
TableEvaluation
The result of evaluating a table
TableOptions
Options for creating a table. Inspired by RecordBatchOptions
TableRef
Expression for an SQL table
TableTestAccessor
A test accessor that uses Table as the underlying table type. Note: this is intended for testing and examples. It is not optimized for performance, so should not be used for benchmarks or production use-cases.
TestSchemaAccessor
A simple in-memory SchemaAccessor for testing intermediate AST -> Provable AST conversion.

Enums§

Column
Represents a read-only view of a column in an in-memory, column-oriented database.
ColumnOperationError
Errors from operations on columns.
ColumnType
Represents the supported data types of a column in an in-memory, column-oriented database.
ColumnarValue
The result of evaluating an expression.
LiteralValue
Represents a literal value.
OwnedColumn
Supported types for OwnedColumn
OwnedColumnError
Errors from operations related to OwnedColumns.
OwnedTableError
An error that occurs when working with tables.
ParseError
Errors encountered during the parsing process
TableOperationError
Errors from operations on tables.

Traits§

CommitmentAccessor
Access commitments of database columns.
DataAccessor
Access database columns of an in-memory table span.
MetadataAccessor
Access metadata of a table span in a database.
SchemaAccessor
Access tables and their schemas in a database.
TestAccessor
A trait that defines the interface for a combined metadata, schema, commitment, and data accessor for unit testing or example purposes.

Functions§

can_and_or_types
Verifies that two types can be used in a logical AND or OR expressions
can_not_type
Verifies that the NOT expr can be used on an expression
try_add_subtract_column_types
Determine the output type of an add or subtract operation if it is possible to add or subtract the two input types. If the types are not compatible, return an error.
try_add_subtract_column_types_with_scaling
Determine the output type of an add or subtract operation if it is possible to add or subtract the two input types. Scaling is allowed. If the types are not compatible, return an error.
try_cast_types
Verifies that from can be cast to to. For now, this supports a limited number of casts.
try_divide_column_types
Determine the output type of a division operation if it is possible to divide the two input types. If the types are not compatible, return an error.
try_equals_types
Verfies that the equality operator can be used on the two types
try_equals_types_with_scaling
Verfies that the equality operator can be used on the two types with scaling allowed
try_inequality_types
Verifies that two types can be compared using inequalities
try_inequality_types_with_scaling
Verifies that two types can be compared using inequalities with scaling allowed
try_multiply_column_types
Determine the output type of a multiplication operation if it is possible to multiply the two input types. If the types are not compatible, return an error.
try_scale_cast_types
Verifies that from can be cast to to. Casting can only be supported if the resulting data type is a superset of the input data type. For example Deciaml(6,1) can be cast to Decimal(7,1), but not vice versa.

Type Aliases§

ColumnOperationResult
Result type for column operations
OwnedColumnResult
Result type for operations related to OwnedColumns.
TableOperationResult
Result type for table operations