risingwave_frontend::binder

Struct Binder

source
pub struct Binder {
Show 19 fields catalog: ArcRwLockReadGuard<RawRwLock, Catalog>, db_name: String, session_id: SessionId, context: BindContext, auth_context: Arc<AuthContext>, upper_subquery_contexts: Vec<(BindContext, Vec<LateralBindContext>)>, lateral_contexts: Vec<LateralBindContext>, next_subquery_id: usize, next_values_id: usize, next_share_id: usize, session_config: Arc<RwLock<SessionConfig>>, search_path: SearchPath, bind_for: BindFor, shared_views: HashMap<u32, usize>, included_relations: HashSet<TableId>, included_udfs: HashSet<FunctionId>, param_types: ParameterTypes, udf_context: UdfContext, temporary_source_manager: TemporarySourceManager,
}
Expand description

Binder binds the identifiers in AST to columns in relations

Fields§

§catalog: ArcRwLockReadGuard<RawRwLock, Catalog>§db_name: String§session_id: SessionId§context: BindContext§auth_context: Arc<AuthContext>§upper_subquery_contexts: Vec<(BindContext, Vec<LateralBindContext>)>

A stack holding contexts of outer queries when binding a subquery. It also holds all of the lateral contexts for each respective subquery.

See Binder::bind_subquery_expr for details.

§lateral_contexts: Vec<LateralBindContext>

A stack holding contexts of left-lateral TableFactors.

We need a separate stack as CorrelatedInputRef depth is determined by the upper subquery context depth, not the lateral context stack depth.

§next_subquery_id: usize§next_values_id: usize§next_share_id: usize

The ShareId is used to identify the share relation which could be a CTE, a source, a view and so on.

§session_config: Arc<RwLock<SessionConfig>>§search_path: SearchPath§bind_for: BindFor

The type of binding statement.

§shared_views: HashMap<u32, usize>

ShareIds identifying shared views.

§included_relations: HashSet<TableId>

The included relations while binding a query.

§included_udfs: HashSet<FunctionId>

The included user-defined functions while binding a query.

§param_types: ParameterTypes§udf_context: UdfContext

The sql udf context that will be used during binding phase

§temporary_source_manager: TemporarySourceManager

The temporary sources that will be used during binding phase

Implementations§

source§

impl Binder

source

pub fn bind_columns_to_context( &mut self, name: String, column_catalogs: &[ColumnCatalog], ) -> Result<(), RwError>

source

pub fn get_column_binding_index( &mut self, table_name: String, column_name: &String, ) -> Result<usize, RwError>

source§

impl Binder

source

pub(super) fn bind_delete( &mut self, name: ObjectName, selection: Option<Expr>, returning_items: Vec<SelectItem>, ) -> Result<BoundDelete, RwError>

source§

impl Binder

source

pub(super) fn bind_binary_op( &mut self, left: Expr, op: BinaryOperator, right: Expr, ) -> Result<ExprImpl, RwError>

source

fn resolve_binary_operator( op: BinaryOperator, bound_left: &ExprImpl, bound_right: &ExprImpl, ) -> Result<Vec<ExprType>, RwError>

source§

impl Binder

source

pub fn bind_column(&mut self, idents: &[Ident]) -> Result<ExprImpl, RwError>

source§

impl Binder

source

fn ensure_aggregate_allowed(&self) -> Result<(), RwError>

source

pub(super) fn bind_aggregate_function( &mut self, agg_type: AggType, distinct: bool, args: Vec<ExprImpl>, order_by: Vec<OrderByExpr>, within_group: Option<Box<OrderByExpr>>, filter: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

fn bind_ordered_set_agg( &mut self, kind: &AggType, distinct: bool, args: Vec<ExprImpl>, order_by: Vec<OrderByExpr>, within_group: Option<Box<OrderByExpr>>, ) -> Result<(Vec<Literal>, Vec<ExprImpl>, OrderBy), RwError>

source

fn bind_normal_agg( &mut self, kind: &AggType, distinct: bool, args: Vec<ExprImpl>, order_by: Vec<OrderByExpr>, within_group: Option<Box<OrderByExpr>>, ) -> Result<(Vec<Literal>, Vec<ExprImpl>, OrderBy), RwError>

source§

impl Binder

source§

impl Binder

source§

impl Binder

source§

impl Binder

source

pub(super) fn bind_order_by_expr( &mut self, _: OrderByExpr, ) -> Result<BoundOrderByExpr, RwError>

Bind an ORDER BY expression in other places than Query, including in OVER and in aggregate functions.

Different from a query-level ORDER BY (Self::bind_order_by_expr_in_query), output-column names or numbers are not allowed here.

source§

impl Binder

source

pub fn bind_subquery_expr( &mut self, query: Query, kind: SubqueryKind, ) -> Result<ExprImpl, RwError>

source§

impl Binder

source

pub fn bind_value(&mut self, value: Value) -> Result<Literal, RwError>

source

pub(super) fn bind_string(&mut self, s: String) -> Result<Literal, RwError>

source

fn bind_bool(&mut self, b: bool) -> Result<Literal, RwError>

source

fn bind_number(&mut self, s: String) -> Result<Literal, RwError>

source

fn bind_interval( &mut self, s: String, leading_field: Option<AstDateTimeField>, ) -> Result<Literal, RwError>

source

pub(crate) fn bind_date_time_field(field: AstDateTimeField) -> DateTimeField

source

pub(super) fn bind_array( &mut self, exprs: Vec<Expr>, ) -> Result<ExprImpl, RwError>

ARRAY[...] is represented as an function call at the binder stage.

source

pub(super) fn bind_map( &mut self, entries: Vec<(Expr, Expr)>, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_array_cast( &mut self, exprs: Vec<Expr>, element_type: Box<DataType>, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_map_cast( &mut self, entries: Vec<(Expr, Expr)>, map_type: MapType, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_index( &mut self, obj: Expr, index: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_array_range_index( &mut self, obj: Expr, start: Option<Box<Expr>>, end: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_row(&mut self, exprs: Vec<Expr>) -> Result<ExprImpl, RwError>

Row(...) is represented as an function call at the binder stage.

source§

impl Binder

source

pub fn bind_expr(&mut self, expr: Expr) -> Result<ExprImpl, RwError>

Bind an expression with bind_expr_inner, attach the original expression to the error message.

This may only be called at the root of the expression tree or when crossing the boundary of a subquery. Otherwise, the source chain might be too deep and confusing to the user.

source

fn bind_expr_inner(&mut self, expr: Expr) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_extract( &mut self, field: String, expr: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_at_time_zone( &mut self, input: Expr, time_zone: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_in_list( &mut self, expr: Expr, list: Vec<Expr>, negated: bool, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_in_subquery( &mut self, expr: Expr, subquery: Query, negated: bool, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_is_json( &mut self, expr: Expr, negated: bool, item_type: JsonPredicateType, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_unary_expr( &mut self, op: UnaryOperator, expr: Expr, ) -> Result<ExprImpl, RwError>

source

fn rewrite_positive(&mut self, expr: Expr) -> Result<ExprImpl, RwError>

Directly returns the expression itself if it is a positive number.

source

pub(super) fn bind_trim( &mut self, expr: Expr, trim_where: Option<TrimWhereField>, trim_what: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

fn bind_substring( &mut self, expr: Expr, substring_from: Option<Box<Expr>>, substring_for: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

fn bind_position( &mut self, substring: Expr, string: Expr, ) -> Result<ExprImpl, RwError>

source

fn bind_overlay( &mut self, expr: Expr, new_substring: Expr, start: Expr, count: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

fn bind_parameter(&mut self, index: u64) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_between( &mut self, expr: Expr, negated: bool, low: Expr, high: Expr, ) -> Result<ExprImpl, RwError>

Bind expr (not) between low and high

source

fn bind_like( &mut self, expr_type: ExprType, expr: Expr, negated: bool, pattern: Expr, escape_char: Option<EscapeChar>, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_similar_to( &mut self, expr: Expr, negated: bool, pattern: Expr, escape_char: Option<EscapeChar>, ) -> Result<ExprImpl, RwError>

Bind <expr> [ NOT ] SIMILAR TO <pat> ESCAPE <esc_text>

source

fn check_constant_case_when_optimization( &mut self, conditions: Vec<Expr>, results_expr: Vec<ExprImpl>, operand: Option<Box<Expr>>, fallback: Option<ExprImpl>, constant_case_when_eval_inputs: &mut Vec<ExprImpl>, ) -> bool

The optimization check for the following case-when expression pattern e.g., select case 1 when (…) then (…) else (…) end;

source

fn compare_or_set(col_expr: &mut Option<Expr>, test_expr: Expr) -> bool

Helper function to compare or set column identifier used in check_convert_simple_form

source

fn check_invariant(left: Expr, op: BinaryOperator, right: Expr) -> bool

left expression and right expression must be either: <constant> <Eq> <identifier> or <identifier> <Eq> <constant> used in check_convert_simple_form

source

fn try_extract_simple_form( &mut self, ident_expr: Expr, constant_expr: Expr, column_expr: &mut Option<Expr>, inputs: &mut Vec<ExprImpl>, ) -> bool

Helper function to extract expression out and insert the corresponding bound version to inputs used in check_convert_simple_form Note: this function will be invoked per arm

source

fn check_convert_simple_form( &mut self, conditions: Vec<Expr>, results_expr: Vec<ExprImpl>, fallback: Option<ExprImpl>, constant_lookup_inputs: &mut Vec<ExprImpl>, ) -> bool

See if the case when expression in form select case when <expr_1 = constant> (...with same pattern...) else <constant> end; If so, this expression could also be converted to constant lookup

source

fn check_bind_case_optimization( &mut self, conditions: Vec<Expr>, results_expr: Vec<ExprImpl>, operand: Option<Box<Expr>>, fallback: Option<ExprImpl>, constant_lookup_inputs: &mut Vec<ExprImpl>, ) -> bool

The helper function to check if the current case-when expression in bind_case could be optimized into ConstantLookupExpression

source

pub(super) fn bind_case( &mut self, operand: Option<Box<Expr>>, conditions: Vec<Expr>, results: Vec<Expr>, else_result: Option<Box<Expr>>, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_is_operator( &mut self, func_type: ExprType, expr: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_is_unknown( &mut self, func_type: ExprType, expr: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_distinct_from( &mut self, left: Expr, right: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_not_distinct_from( &mut self, left: Expr, right: Expr, ) -> Result<ExprImpl, RwError>

source

pub(super) fn bind_cast( &mut self, expr: Expr, data_type: AstDataType, ) -> Result<ExprImpl, RwError>

source

pub fn bind_cast_inner( &mut self, expr: Expr, data_type: DataType, ) -> Result<ExprImpl, RwError>

source

pub fn bind_collate( &mut self, expr: Expr, collation: ObjectName, ) -> Result<ExprImpl, RwError>

source§

impl Binder

source

pub fn bind_fetch_cursor( &mut self, cursor_name: String, count: u32, returning_schema: Option<Schema>, ) -> Result<BoundFetchCursor, RwError>

source§

impl Binder

source§

impl Binder

source

pub(super) fn bind_insert( &mut self, name: ObjectName, cols_to_insert_by_user: Vec<Ident>, source: Query, returning_items: Vec<SelectItem>, ) -> Result<BoundInsert, RwError>

source

pub(super) fn cast_on_insert( expected_types: &Vec<DataType>, exprs: Vec<ExprImpl>, ) -> Result<Vec<ExprImpl>, RwError>

Cast a list of exprs to corresponding expected_types IN ASSIGNMENT CONTEXT. Make sure you understand the difference of implicit, assignment and explicit cast before reusing it.

source§

impl Binder

source

pub fn bind_query(&mut self, query: Query) -> Result<BoundQuery, RwError>

Bind a Query.

Before binding the Query, we push the current BindContext to the stack and create a new context, because it may be a subquery.

After finishing binding, we pop the previous context from the stack.

source

pub(super) fn bind_query_inner( &mut self, _: Query, ) -> Result<BoundQuery, RwError>

Bind a Query using the current BindContext.

source

pub fn build_name_to_index( names: impl Iterator<Item = String>, ) -> HashMap<String, usize>

source

fn bind_order_by_expr_in_query( &mut self, _: OrderByExpr, name_to_index: &HashMap<String, usize>, extra_order_exprs: &mut Vec<ExprImpl>, visible_output_num: usize, ) -> Result<ColumnOrder, RwError>

Bind an ORDER BY expression in a Query, which can be either:

  • an output-column name
  • index of an output column
  • an arbitrary expression

Refer to bind_group_by_expr_in_select to see their similarities and differences.

§Arguments
  • name_to_index - visible output column name -> index. Ambiguous (duplicate) output names are marked with usize::MAX.
  • visible_output_num - the number of all visible output columns, including duplicates.
source

fn bind_with(&mut self, with: With) -> Result<(), RwError>

source

fn validate_rcte(query: Query) -> Result<(SetExpr, Option<With>), RwError>

syntactically validate the recursive cte ast with the current support features in rw.

source

fn bind_rcte( &mut self, with: Option<With>, entry: Rc<RefCell<BindingCte>>, left: SetExpr, right: SetExpr, all: bool, ) -> Result<(), RwError>

source

fn bind_rcte_inner( &mut self, with: Option<With>, entry: Rc<RefCell<BindingCte>>, left: SetExpr, right: SetExpr, all: bool, ) -> Result<(), RwError>

source§

impl Binder

source

pub(crate) fn bind_vec_table_with_joins( &mut self, from: Vec<TableWithJoins>, ) -> Result<Option<Relation>, RwError>

source

pub(crate) fn bind_table_with_joins( &mut self, table: TableWithJoins, ) -> Result<Relation, RwError>

source

fn bind_join_constraint( &mut self, constraint: JoinConstraint, table_factor: Option<TableFactor>, join_type: JoinType, ) -> Result<(ExprImpl, Option<Relation>), RwError>

source

fn get_identifier_from_indices( context: &BindContext, indices: &[usize], column: Ident, ) -> Result<Expr, RwError>

source§

impl Binder

source

pub(super) fn bind_subquery_relation( &mut self, query: Query, alias: Option<TableAlias>, lateral: bool, ) -> Result<BoundSubquery, RwError>

Binds a subquery using bind_query, which will use a new empty BindContext for it.

After finishing binding, we update the current context with the output of the subquery.

source§

impl Binder

source

pub(super) fn bind_table_function( &mut self, name: ObjectName, alias: Option<TableAlias>, args: Vec<FunctionArg>, with_ordinality: bool, ) -> Result<Relation, RwError>

Binds a table function AST, which is a function call in a relation position.

Besides crate::expr::TableFunction expr, it can also be other things like window table functions, or scalar functions.

with_ordinality is only supported for the TableFunction case now.

source§

impl Binder

source

pub fn bind_relation_by_name_inner( &mut self, schema_name: Option<&str>, table_name: &str, alias: Option<TableAlias>, as_of: Option<AsOf>, ) -> Result<Relation, RwError>

Binds table or source, or logical view according to what we get from the catalog.

source

fn resolve_table_relation( &mut self, table_catalog: Arc<TableCatalog>, schema_name: &str, as_of: Option<AsOf>, ) -> Result<(Relation, Vec<(bool, Field)>), RwError>

source

fn resolve_source_relation( &mut self, source_catalog: &SourceCatalog, as_of: Option<AsOf>, ) -> (Relation, Vec<(bool, Field)>)

source

fn resolve_view_relation( &mut self, view_catalog: &ViewCatalog, ) -> Result<(Relation, Vec<(bool, Field)>), RwError>

source

fn resolve_table_indexes( &self, schema_name: &str, table_id: TableId, ) -> Result<Vec<Arc<IndexCatalog>>, RwError>

source

pub(crate) fn bind_table( &mut self, schema_name: Option<&str>, table_name: &str, alias: Option<TableAlias>, ) -> Result<BoundBaseTable, RwError>

source

pub(crate) fn resolve_dml_table<'a>( &'a self, schema_name: Option<&str>, table_name: &str, is_insert: bool, ) -> Result<&'a TableCatalog, RwError>

source§

impl Binder

source

pub(super) fn bind_watermark( &mut self, alias: Option<TableAlias>, args: Vec<FunctionArg>, ) -> Result<BoundWatermark, RwError>

source§

impl Binder

source§

impl Binder

source

pub fn resolve_schema_qualified_name( db_name: &str, name: ObjectName, ) -> Result<(Option<String>, String), ResolveQualifiedNameError>

return (schema_name, name)

source

fn resolve_single_name( identifiers: Vec<Ident>, ident_desc: &str, ) -> Result<String, RwError>

return first name in identifiers, must have only one name.

source

pub fn resolve_database_name(name: ObjectName) -> Result<String, RwError>

return the database_name

source

pub fn resolve_schema_name(name: ObjectName) -> Result<String, RwError>

return the schema_name

source

pub fn resolve_index_name(name: ObjectName) -> Result<String, RwError>

return the index_name

source

pub fn resolve_view_name(name: ObjectName) -> Result<String, RwError>

return the view_name

source

pub fn resolve_sink_name(name: ObjectName) -> Result<String, RwError>

return the sink_name

source

pub fn resolve_subscription_name(name: ObjectName) -> Result<String, RwError>

return the subscription_name

source

pub fn resolve_table_name(name: ObjectName) -> Result<String, RwError>

return the table_name

source

pub fn resolve_source_name(name: ObjectName) -> Result<String, RwError>

return the source_name

source

pub fn resolve_user_name(name: ObjectName) -> Result<String, RwError>

return the user_name

source

pub(super) fn bind_table_to_context( &mut self, columns: impl IntoIterator<Item = (bool, Field)>, table_name: String, alias: Option<TableAlias>, ) -> Result<(), RwError>

Fill the BindContext for table.

source

pub fn bind_relation_by_name( &mut self, name: ObjectName, alias: Option<TableAlias>, as_of: Option<AsOf>, ) -> Result<Relation, RwError>

Binds a relation, which can be:

  • a table/source/materialized view
  • a reference to a CTE
  • a logical view
source

fn bind_relation_by_function_arg( &mut self, arg: Option<FunctionArg>, err_msg: &str, ) -> Result<(Relation, ObjectName), RwError>

source

fn bind_column_by_function_args( &mut self, arg: Option<FunctionArg>, err_msg: &str, ) -> Result<Box<InputRef>, RwError>

source

fn bind_internal_table( &mut self, args: Vec<FunctionArg>, alias: Option<TableAlias>, ) -> Result<Relation, RwError>

rw_table(table_id[,schema_name]) which queries internal table

source

pub(super) fn bind_table_factor( &mut self, table_factor: TableFactor, ) -> Result<Relation, RwError>

source§

impl Binder

source

pub(super) fn bind_select( &mut self, select: Select, ) -> Result<BoundSelect, RwError>

source

pub fn bind_select_list( &mut self, select_items: Vec<SelectItem>, ) -> Result<(Vec<ExprImpl>, Vec<Option<String>>), RwError>

source

fn bind_group_by_expr_in_select( &mut self, expr: Expr, name_to_index: &HashMap<String, usize>, select_items: &[ExprImpl], ) -> Result<ExprImpl, RwError>

Bind an GROUP BY expression in a Select, which can be either:

  • index of an output column
  • an arbitrary expression on input columns
  • an output-column name

Note the differences from bind_order_by_expr_in_query:

  • When a name matches both an input column and an output column, group by interprets it as input column while order by interprets it as output column.
  • As the name suggests, group by is part of select while order by is part of query. A query may consist unions of multiple selects (each with their own group by) but only one order by.
  • Logically / semantically, group by evaluates before select items, which evaluates before order by. This means, group by can evaluate arbitrary expressions itself, or take expressions from select items (we clone here and logical_agg will rewrite those select items to InputRef). However, order by can only refer to select items, or append its extra arbitrary expressions as hidden select items for evaluation.
§Arguments
  • name_to_index - output column name -> index. Ambiguous (duplicate) output names are marked with usize::MAX.
source

fn bind_grouping_items_expr_in_select( &mut self, grouping_items: Vec<Vec<Expr>>, name_to_index: &HashMap<String, usize>, select_items: &[ExprImpl], ) -> Result<Vec<Vec<ExprImpl>>, RwError>

source

pub fn bind_returning_list( &mut self, returning_items: Vec<SelectItem>, ) -> Result<(Vec<ExprImpl>, Vec<Field>), RwError>

source

pub fn iter_bound_columns<'a>( column_binding: impl Iterator<Item = &'a ColumnBinding>, ) -> (Vec<ExprImpl>, Vec<Option<String>>)

source

pub fn iter_column_groups(&self) -> (Vec<ExprImpl>, Vec<Option<String>>)

source

fn bind_distinct_on( &mut self, distinct: Distinct, name_to_index: &HashMap<String, usize>, select_items: &[ExprImpl], ) -> Result<BoundDistinct, RwError>

Bind DISTINCT clause in a Select. Note that for DISTINCT ON, each expression is interpreted in the same way as ORDER BY expression, which means it will be bound in the following order:

  • as an output-column name (can use aliases)
  • as an index (from 1) of an output column
  • as an arbitrary expression (cannot use aliases)

See also the bind_order_by_expr_in_query method.

§Arguments
  • name_to_index - output column name -> index. Ambiguous (duplicate) output names are marked with usize::MAX.
source

fn generate_except_indices( &mut self, except: Option<Vec<Expr>>, ) -> Result<HashSet<usize>, RwError>

source§

impl Binder

source

pub(crate) fn align_schema( left: &mut BoundSetExpr, right: &mut BoundSetExpr, op: SetOperator, ) -> Result<(), RwError>

note: align_schema only works when the left and right are both select expression(s).

source

pub(crate) fn validate( left: &BoundSetExpr, right: &BoundSetExpr, op: SetOperator, ) -> Result<(), RwError>

validate the schema, should be called after aligning.

source

fn corresponding( &self, left: &BoundSetExpr, right: &BoundSetExpr, corresponding: Corresponding, op: &SetOperator, ) -> Result<(ColIndexMapping, ColIndexMapping), RwError>

Check the corresponding specification of the set operation. Returns the corresponding column index of the left and right side.

source

pub(super) fn bind_set_expr( &mut self, set_expr: SetExpr, ) -> Result<BoundSetExpr, RwError>

source§

impl Binder

source

pub(super) fn bind_statement( &mut self, stmt: Statement, ) -> Result<BoundStatement, RwError>

source§

impl Binder

source

fn extract_struct_column( &mut self, expr: Expr, field_idents: Vec<Ident>, ) -> Result<(ExprImpl, Vec<Ident>), RwError>

Extracts and binds struct column from expr. Returns the bound column and the remaining fields.

Specifically,

  • (table).struct_col.fields -> (bound_struct_col, fields)
  • Otherwise, expr corresponds to a column. (expr).fields -> (bound_expr, fields)
source

pub fn bind_wildcard_field_column( &mut self, expr: Expr, prefix: Vec<Ident>, ) -> Result<(Vec<ExprImpl>, Vec<Option<String>>), RwError>

Binds wildcard field column, e.g. (table.v1).* or (table).v1.*.

Returns a vector of Field(expr, int) expressions and aliases.

source

pub fn bind_single_field_column( &mut self, expr: Expr, idents: &[Ident], ) -> Result<ExprImpl, RwError>

Binds single field column, e.g. (table.v1).v2 or (table).v1.v2.

Returns a Field(expr, int) expression.

source

fn bind_field( field_name: String, expr: ExprImpl, idents: &[Ident], wildcard: bool, ) -> Result<Vec<(ExprImpl, String)>, RwError>

Bind field in recursive way. It could return a couple Field expressions if it ends with a wildcard.

source

fn bind_wildcard_field( expr: ExprImpl, ) -> Result<Vec<(ExprImpl, String)>, RwError>

Will fail if it’s an atomic value. Rewrite (expr:Struct).* to [Field(expr, 0), Field(expr, 1), … Field(expr, n)].

source§

impl Binder

source

pub(super) fn bind_update( &mut self, name: ObjectName, assignments: Vec<Assignment>, selection: Option<Expr>, returning_items: Vec<SelectItem>, ) -> Result<BoundUpdate, RwError>

source§

impl Binder

source

pub(super) fn bind_values( &mut self, values: Values, expected_types: Option<Vec<DataType>>, ) -> Result<BoundValues, RwError>

Bind Values with given expected_types. If no types are expected, a compatible type for all rows will be used. If values are shorter than expected, NULLs will be filled.

source§

impl Binder

source

fn new_inner( session: &SessionImpl, bind_for: BindFor, param_types: Vec<Option<DataType>>, ) -> Binder

source

pub fn new(session: &SessionImpl) -> Binder

source

pub fn new_with_param_types( session: &SessionImpl, param_types: Vec<Option<DataType>>, ) -> Binder

source

pub fn new_for_stream(session: &SessionImpl) -> Binder

source

pub fn new_for_ddl(session: &SessionImpl) -> Binder

source

pub fn new_for_system(session: &SessionImpl) -> Binder

source

pub fn new_for_stream_with_param_types( session: &SessionImpl, param_types: Vec<Option<DataType>>, ) -> Binder

source

fn is_for_stream(&self) -> bool

source

fn is_for_batch(&self) -> bool

source

fn is_for_ddl(&self) -> bool

source

pub fn bind(&mut self, stmt: Statement) -> Result<BoundStatement, RwError>

Bind a Statement.

source

pub fn export_param_types(&self) -> Result<Vec<DataType>, RwError>

source

pub fn included_relations(&self) -> &HashSet<TableId>

Get included relations in the query after binding. This is used for resolving relation dependencies. Note that it only contains referenced relations discovered during binding. After the plan is built, the referenced relations may be changed. We cannot rely on the collection result of plan, because we still need to record the dependencies that have been optimised away.

source

pub fn included_udfs(&self) -> &HashSet<FunctionId>

Get included user-defined functions in the query after binding.

source

fn push_context(&mut self)

source

fn pop_context(&mut self) -> Result<(), RwError>

source

fn push_lateral_context(&mut self)

source

fn pop_and_merge_lateral_context(&mut self) -> Result<(), RwError>

source

fn try_mark_lateral_as_visible(&mut self)

source

fn try_mark_lateral_as_invisible(&mut self)

source

fn next_subquery_id(&mut self) -> usize

source

fn next_values_id(&mut self) -> usize

source

fn next_share_id(&mut self) -> usize

source

fn first_valid_schema(&self) -> Result<&SchemaCatalog, CatalogError>

source

pub fn set_clause(&mut self, clause: Option<Clause>)

source

pub fn udf_context_mut(&mut self) -> &mut UdfContext

Auto Trait Implementations§

§

impl Freeze for Binder

§

impl !RefUnwindSafe for Binder

§

impl !Send for Binder

§

impl !Sync for Binder

§

impl Unpin for Binder

§

impl !UnwindSafe for Binder

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<M> MetricVecRelabelExt for M

source§

fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

source§

fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>

source§

fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

Equivalent to RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to MetricLevel::Debug and relabel_num set to 1.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> SerTo<T> for T

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more