Skip to content

Commit

Permalink
Optimized column handling and cleaned up code in `alter_table_column.…
Browse files Browse the repository at this point in the history
…rs`.
  • Loading branch information
shanicky committed Jun 11, 2024
1 parent 15bddb4 commit 8032588
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions src/frontend/src/handler/alter_table_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::{HashMap, HashSet};
use std::collections::{HashSet};
use std::rc::Rc;
use std::sync::Arc;

Expand All @@ -24,8 +24,6 @@ use risingwave_common::bail_not_implemented;
use risingwave_common::catalog::ColumnCatalog;
use risingwave_common::util::column_index_mapping::ColIndexMapping;
use risingwave_connector::sink::catalog::SinkCatalog;
use risingwave_pb::plan_common::column_desc::GeneratedOrDefaultColumn;
use risingwave_pb::plan_common::DefaultColumnDesc;
use risingwave_pb::stream_plan::StreamFragmentGraph;
use risingwave_sqlparser::ast::{
AlterTableOperation, ColumnOption, ConnectorSchema, Encode, ObjectName, Statement,
Expand Down Expand Up @@ -141,8 +139,8 @@ pub(crate) fn hijack_merger_for_target_table(
let exprs = derive_default_column_project_for_sink(
sink,
&sink.full_schema(),
&target_columns,
&default_columns,
target_columns,
default_columns,
false, // todo
)?;

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/handler/create_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use crate::expr::{ExprImpl, InputRef};
use crate::handler::alter_table_column::fetch_table_catalog_for_alter;
use crate::handler::create_mv::parse_column_names;
use crate::handler::create_table::{
bind_sql_columns, generate_stream_graph_for_table, ColumnIdGenerator,
generate_stream_graph_for_table, ColumnIdGenerator,
};
use crate::handler::privilege::resolve_query_privileges;
use crate::handler::util::SourceSchemaCompatExt;
Expand Down
5 changes: 2 additions & 3 deletions src/frontend/src/handler/drop_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use std::collections::HashSet;
use std::rc::Rc;
use std::sync::Arc;

use pgwire::pg_response::{PgResponse, StatementType};
use risingwave_pb::ddl_service::ReplaceTablePlan;
Expand All @@ -26,7 +25,7 @@ use crate::catalog::root_catalog::SchemaPath;
use crate::error::Result;
use crate::expr::ExprImpl;
use crate::handler::create_sink::{
fetch_incoming_sinks, insert_merger_to_union, reparse_table_for_sink,
fetch_incoming_sinks, reparse_table_for_sink,
};
use crate::handler::HandlerArgs;
use crate::{OptimizerContext, TableCatalog};
Expand Down Expand Up @@ -92,7 +91,7 @@ pub async fn handle_drop_sink(

assert!(incoming_sink_ids.remove(&sink_id.sink_id));

let mut incoming_sinks = fetch_incoming_sinks(&session, &incoming_sink_ids)?;
let incoming_sinks = fetch_incoming_sinks(&session, &incoming_sink_ids)?;

for sink in incoming_sinks {
let context = Rc::new(OptimizerContext::from_handler_args(handler_args.clone()));
Expand Down
4 changes: 2 additions & 2 deletions src/meta/src/rpc/ddl_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2168,15 +2168,15 @@ impl DdlController {
// 3. Build the table fragments structure that will be persisted in the stream manager, and
// the context that contains all information needed for building the actors on the compute
// nodes.
let mut table_fragments = TableFragments::new(
let table_fragments = TableFragments::new(
dummy_table_id.into(),
graph,
&building_locations.actor_locations,
stream_ctx,
old_table_fragments.assigned_parallelism,
);

let mut ctx = ReplaceTableContext {
let ctx = ReplaceTableContext {
old_table_fragments,
merge_updates,
dispatchers,
Expand Down

0 comments on commit 8032588

Please sign in to comment.