use super::CumlOperation;
use crate::{error::Error, gpu_functions::dense_relation_errors::DenseRelationErrorContext};
pub(super) const ERRORS: DenseRelationErrorContext = DenseRelationErrorContext {
family: "cuML",
operation_fact: "cuml_operation",
validate_operation: "algeon_datafusion.cuml_sql.validate",
validate_schema_operation: "algeon_datafusion.cuml_sql.validate_schema",
execute_operation: "algeon_datafusion.cuml_sql.execute",
required_feature: "cuml",
feature_disabled_message: "cuML algorithm execution requires the cuml Cargo feature",
};
pub(super) fn invalid_call(operation: CumlOperation, reason: &'static str, message: impl Into<String>) -> Error {
ERRORS.invalid_call(operation.descriptor().sql_function_name, reason, message)
}
pub(super) fn invalid_option(
operation: CumlOperation,
reason: &'static str,
argument: Option<&'static str>,
message: impl Into<String>,
) -> Error {
ERRORS.invalid_option(operation.descriptor().sql_function_name, reason, argument, message)
}
pub(super) fn field_not_found(operation: CumlOperation, relation_role: &'static str, field: &str) -> Error {
ERRORS.field_not_found(operation.descriptor().sql_function_name, relation_role, field)
}
pub(super) fn unsupported_type(
operation: CumlOperation,
relation_role: &'static str,
field: &str,
actual: impl ToString,
expected: impl ToString,
) -> Error {
ERRORS.unsupported_type(operation.descriptor().sql_function_name, relation_role, field, actual, expected)
}
pub(super) fn feature_disabled(operation: CumlOperation) -> Error {
ERRORS.feature_disabled(operation.descriptor().sql_function_name)
}