Skip to content

Commit

Permalink
docs: improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed Jan 4, 2024
1 parent 94ddf8a commit 6c49e04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/catalog/src/information_schema/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use datatypes::value::Value;
use store_api::storage::ScanRequest;

type ColumnName = String;
/// Predicate to filter information_schema tables stream,
/// Predicate to filter `information_schema` tables stream,
/// we only support these simple predicates currently.
/// TODO(dennis): supports more predicate types.
#[derive(Clone, PartialEq, Eq, Debug)]
Expand All @@ -33,9 +33,9 @@ enum Predicate {

impl Predicate {
/// Evaluate the predicate with the row, returns:
/// - None when the predicate can't evaluate with the row.
/// - Some(true) when the predicate is satisfied,
/// - Some(false) when the predicate is not satisfied,
/// - `None` when the predicate can't evaluate with the row.
/// - `Some(true)` when the predicate is satisfied,
/// - `Some(false)` when the predicate is not satisfied,
fn eval(&self, row: &[(&str, &Value)]) -> Option<bool> {
match self {
Predicate::Eq(c, v) => {
Expand Down Expand Up @@ -91,7 +91,7 @@ impl Predicate {
None
}

/// Try to create a predicate from datafusion `Expr`, return None if fails.
/// Try to create a predicate from datafusion [`Expr`], return None if fails.
fn from_expr(expr: DfExpr) -> Option<Predicate> {
match expr {
// NOT expr
Expand Down Expand Up @@ -189,7 +189,7 @@ pub struct Predicates {
}

impl Predicates {
/// Try its best to create predicates from `ScanRequest`.
/// Try its best to create predicates from [`ScanRequest`].
pub fn from_scan_request(request: &Option<ScanRequest>) -> Predicates {
if let Some(request) = request {
let mut predicates = Vec::with_capacity(request.filters.len());
Expand Down Expand Up @@ -236,7 +236,7 @@ impl Predicates {
}
}

/// Returns true when the values are all `ScalarValue`.
/// Returns true when the values are all [`DfExpr::Literal`].
fn is_all_scalars(list: &[DfExpr]) -> bool {
list.iter().all(|v| matches!(v, DfExpr::Literal(_)))
}
Expand Down

0 comments on commit 6c49e04

Please sign in to comment.