Skip to content

Commit

Permalink
chore: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed Jan 4, 2024
1 parent b8f5a73 commit 618d483
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/catalog/src/information_schema/key_column_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use crate::CatalogManager;

const CONSTRAINT_SCHEMA: &str = "constraint_schema";
const CONSTRAINT_NAME: &str = "constraint_name";
const TABLE_CATALOG: &str = "table_catalog";
const TABLE_SCHEMA: &str = "table_schema";
const TABLE_NAME: &str = "table_name";
const COLUMN_NAME: &str = "column_name";
Expand Down Expand Up @@ -73,7 +74,7 @@ impl InformationSchemaKeyColumnUsage {
false,
),
ColumnSchema::new(CONSTRAINT_NAME, ConcreteDataType::string_datatype(), false),
ColumnSchema::new("table_catalog", ConcreteDataType::string_datatype(), false),
ColumnSchema::new(TABLE_CATALOG, ConcreteDataType::string_datatype(), false),
ColumnSchema::new(TABLE_SCHEMA, ConcreteDataType::string_datatype(), false),
ColumnSchema::new(TABLE_NAME, ConcreteDataType::string_datatype(), false),
ColumnSchema::new(COLUMN_NAME, ConcreteDataType::string_datatype(), false),
Expand Down
16 changes: 8 additions & 8 deletions src/catalog/src/information_schema/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Predicate {
return Some(v == *value);
}
}
Predicate::Like(c, pattern, case_insenstive) => {
Predicate::Like(c, pattern, case_insensitive) => {
for (column, value) in row {
if c != column {
continue;
Expand All @@ -61,7 +61,7 @@ impl Predicate {
continue;
};

return like_utf8(bs.as_utf8(), pattern, case_insenstive);
return like_utf8(bs.as_utf8(), pattern, case_insensitive);
}
}
Predicate::NotEq(c, v) => {
Expand Down Expand Up @@ -240,20 +240,20 @@ impl Predicate {
/// Perform SQL left LIKE right, return `None` if fail to evaluate.
/// - `s` the target string
/// - `pattern` the pattern just like '%abc'
/// - `case_insenstive` whether to perform case-insensitive like or not.
fn like_utf8(s: &str, pattern: &str, case_insenstive: &bool) -> Option<bool> {
/// - `case_insensitive` whether to perform case-insensitive like or not.
fn like_utf8(s: &str, pattern: &str, case_insensitive: &bool) -> Option<bool> {
let array = StringArray::from(vec![s]);
let patterns = StringArray::new_scalar(pattern);

let Ok(booleans) = (if *case_insenstive {
let Ok(booleans) = (if *case_insensitive {
comparison::ilike(&array, &patterns)
} else {
comparison::like(&array, &patterns)
}) else {
return None;
};

// Safty: at least one value in result
// Safety: at least one value in result
Some(booleans.value(0))
}

Expand Down Expand Up @@ -408,7 +408,7 @@ mod tests {

#[test]
fn test_predicate_like() {
// case insenstive
// case insensitive
let expr = DfExpr::Like(Like {
negated: false,
expr: Box::new(column("a")),
Expand All @@ -435,7 +435,7 @@ mod tests {
assert!(!p.eval(&unmatch_row).unwrap());
assert!(p.eval(&[]).is_none());

// case senstive
// case sensitive
let expr = DfExpr::Like(Like {
negated: false,
expr: Box::new(column("a")),
Expand Down

0 comments on commit 618d483

Please sign in to comment.