Skip to content

Force ScriptImplementor to explicitly name columns in SELECT#191

Merged
jogrogan merged 2 commits intomainfrom
jogrogan/explicitColumns
Feb 6, 2026
Merged

Force ScriptImplementor to explicitly name columns in SELECT#191
jogrogan merged 2 commits intomainfrom
jogrogan/explicitColumns

Conversation

@jogrogan
Copy link
Collaborator

@jogrogan jogrogan commented Feb 6, 2026

There is a regression in Flink 1.20, previously you could have two schemas where one is a subset of another. Take the following example:

Source Table:

CREATE TABLE IF NOT EXISTS `source` (`field1` VARCHAR, `field2` VARCHAR) WITH (...);

Sink Table:

CREATE TABLE IF NOT EXISTS `sink` (`field1` VARCHAR, `field2` VARCHAR, `field3` VARCHAR) WITH (...);

A flink SQL statement like the following would be valid (we would generate this prior to this PR):

INSERT INTO `sink` (`field1`, `field2`) SELECT * FROM `source`;

In Flink 1.20 this throws an exception with: "Number of columns must match number of query columns".

The fix is to explicitly reference fields.

INSERT INTO `sink` (`field1`, `field2`) SELECT `field1`, `field2` FROM `source`;

This PR changes the behavior to always explicitly name fields, even when a SELECT * would be valid.

@jogrogan jogrogan force-pushed the jogrogan/explicitColumns branch from 4eaaf27 to 1c42dc7 Compare February 6, 2026 16:02
Copy link
Collaborator

@ryannedolan ryannedolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird!

@jogrogan jogrogan merged commit 0196987 into main Feb 6, 2026
1 check passed
@jogrogan jogrogan deleted the jogrogan/explicitColumns branch February 6, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants