pub fn plan_hypothetical_cast(
    ecx: &ExprContext,
    ccx: CastContext,
    from: &ScalarType,
    to: &ScalarType,
) -> Option<::expr::MirScalarExpr> {
    // Reconstruct an expression context where the expression is evaluated on
    // the "first column" of some imaginary row.
    let mut scx = ecx.qcx.scx.clone();
    scx.param_types = RefCell::new(BTreeMap::new());
    let qcx = QueryContext::root(&scx, ecx.qcx.lifetime);
    let relation_type = RelationType {
        column_types: vec![ColumnType {
            nullable: true,
            scalar_type: from.clone(),
        }],
        keys: vec![vec![0]],
    };
    let ecx = ExprContext {
        qcx: &qcx,
        name: "plan_hypothetical_cast",
        scope: &Scope::empty(),
        relation_type: &relation_type,
        allow_aggregates: false,
        allow_subqueries: true,
        allow_windows: false,
    };

    let col_expr = HirScalarExpr::Column(ColumnRef {
        level: 0,
        column: 0,
    });

    // Determine the `ScalarExpr` required to cast our column to the target
    // component type.
    Some(
        plan_cast("plan_hypothetical_cast", &ecx, ccx, col_expr, to)
            .ok()?
            .lower_uncorrelated()
            .expect(
                "lower_uncorrelated should not fail given that there is no correlation \
                in the input col_expr",
            ),
    )
}
/// Similar to `plan_cast`, but for situations where you only know the type of
/// the input expression (`from`) and not the expression itself. The returned
/// expression refers to the first column of some imaginary row, where the first
/// column is assumed to have type `from`.
///
/// If casting from `from` to `to` is not possible, returns `None`.
Similar to `plan_cast`, but for situations where you only know the type of
the input expression (`from`) and not the expression itself. The returned
expression refers to the first column of some imaginary row, where the first
column is assumed to have type `from`.


Similar to ` plan_cast ` but for situations where you only know the type of the input expression ( ` from ` ) and not the expression itself . The returned expression refers to the first column of some imaginary row where the first column is assumed to have type ` from ` .
pub fn plan_hypothetical_cast(
    ecx: &ExprContext,
    ccx: CastContext,
    from: &ScalarType,
    to: &ScalarType,
) -> Option<::expr::MirScalarExpr> {
    // Reconstruct an expression context where the expression is evaluated on
    // the "first column" of some imaginary row.
    let mut scx = ecx.qcx.scx.clone();
    scx.param_types = RefCell::new(BTreeMap::new());
    let qcx = QueryContext::root(&scx, ecx.qcx.lifetime);
    let relation_type = RelationType {
        column_types: vec![ColumnType {
            nullable: true,
            scalar_type: from.clone(),
        }],
        keys: vec![vec![0]],
    };
    let ecx = ExprContext {
        qcx: &qcx,
        name: "plan_hypothetical_cast",
        scope: &Scope::empty(),
        relation_type: &relation_type,
        allow_aggregates: false,
        allow_subqueries: true,
        allow_windows: false,
    };
    let col_expr = HirScalarExpr::Column(ColumnRef {
        level: 0,
        column: 0,
    });
    // Determine the `ScalarExpr` required to cast our column to the target
    // component type.
    Some(
        plan_cast("plan_hypothetical_cast", &ecx, ccx, col_expr, to)
            .ok()?
            .lower_uncorrelated()
            .expect(
                "lower_uncorrelated should not fail given that there is no correlation \
                in the input col_expr",
            ),
    )
}
pub fn plan_hypothetical_cast ( ecx : & ExprContext , ccx : CastContext , from : & ScalarType , to : & ScalarType , ) -> Option < :: expr :: MirScalarExpr > { // Reconstruct an expression context where the expression is evaluated on // the "first column" of some imaginary row. let mut scx = ecx . qcx . scx . clone ( ) ; scx . param_types = RefCell :: new ( BTreeMap :: new ( ) ) ; let qcx = QueryContext :: root ( & scx , ecx . qcx . lifetime ) ; let relation_type = RelationType { column_types : vec ! [ ColumnType { nullable true scalar_type from clone ( ) } ] , keys : vec ! [ vec [ 0 ] ] , } ; let ecx = ExprContext { qcx : & qcx , name : " " , scope : & Scope :: empty ( ) , relation_type : & relation_type , allow_aggregates : false , allow_subqueries : true , allow_windows : false , } ; let col_expr = HirScalarExpr :: Column ( ColumnRef { level : 0 , column : 0 , } ) ; // Determine the `ScalarExpr` required to cast our column to the target // component type. Some ( plan_cast ( " " , & ecx , ccx , col_expr , to ) . ok ( ) ? . lower_uncorrelated ( ) . expect ( " \
 " , ) , ) }
Similar to `plan_cast`, but for situations where you only know the type of
the input expression (`from`) and not the expression itself.
Similar to ` plan_cast ` but for situations where you only know the type of the input expression ( ` from ` ) and not the expression itself .
ecx
&ExprContext
ccx
CastContext
from
&ScalarType
to
&ScalarType
ecx
&ExprContext
ccx
CastContext
from
&ScalarType
to
&ScalarType