-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: when target is table, the sink downstream pk is not set #19515
Conversation
|
||
statement ok | ||
SET STREAMING_PARALLELISM TO 3; | ||
|
||
statement ok | ||
create sink s_simple_1 into m_simple as select v1, v2 from t_simple; | ||
create sink s_simple_1 into m_simple as select v1, v2 from t_simple with (type = 'append-only'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the query because if there is primary key, the original sink plan will be
dev=> explain create sink s_simple_1 into m_simple as select v1, v2 from t_simple;
;
QUERY PLAN
----------------------------------------------------------------------------------------------------------
StreamProject { exprs: [t_simple.v1, t_simple.v2] }
└─StreamSink { type: upsert, columns: [v1, v2, t_simple._row_id(hidden)], downstream_pk: [t_simple.v1] }
└─StreamExchange { dist: HashShard(t_simple.v1) }
└─StreamTableScan { table: t_simple, columns: [v1, v2, _row_id] }
(4 rows)
let target_table_mapping = target_table_mapping.unwrap(); | ||
|
||
t.pk() | ||
.iter() | ||
.map(|c| { | ||
target_table_mapping[c.column_index].ok_or( | ||
ErrorCode::SinkError(Box::new(Error::new(ErrorKind::InvalidInput, | ||
"When using non append only sink into table, the primary key of the table must be included in the sink result.".to_string() | ||
))).into())}) | ||
.try_collect::<_, _, RwError>()? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main changes it to get the down stream pk here, and to get it, the target_table_mapping
is needed
…set (risingwavelabs#19515) to branch release-2.1 (risingwavelabs#19554)
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.