Skip to content
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

feat: Add support for ALTER STREAM|TABLE #6400

Merged
merged 8 commits into from
Oct 19, 2020
Merged

Conversation

jzaralim
Copy link
Contributor

Description

Add new syntax, ALTER STREAM|TABLE. It works as follows:

ksql> alter stream riderlocations add column name string;

 Message
-------------------------------
 Stream RIDERLOCATIONS altered
-------------------------------

ksql> describe extended riderlocations;

...
Statement            : CREATE STREAM riderLocations (profileId VARCHAR, latitude DOUBLE, longitude DOUBLE)
  WITH (kafka_topic='quickstart-locations', value_format='json', partitions=1);alter stream riderLocations add column a string;alter stream riderlocations add column name string;

 Field     | Type
-----------------------------
 PROFILEID | VARCHAR(STRING)
 LATITUDE  | DOUBLE
 LONGITUDE | DOUBLE
 NAME      | VARCHAR(STRING)
-----------------------------

It only works on data sources that are created using DDL statements.

Fixes #6038

Testing done

Unit and QTT tests.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@jzaralim jzaralim requested review from JimGalasyn and a team as code owners October 10, 2020 00:42
Copy link
Member

@JimGalasyn JimGalasyn left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

Thanks @jzaralim! This approach is pretty clean and straightforward. Devil is in the details, so I've added a bunch of comments around that.

@agavra agavra requested a review from spena October 12, 2020 21:40
@jzaralim
Copy link
Contributor Author

I did not write a very good commit message, so here are the main changes in the most recent commit:

  • switching to YATT tests
  • adding a Column serializer/deserializer
  • added a new KsqlException type for duplicate columns

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM! Awesome work @jzaralim

@jzaralim jzaralim merged commit a58e041 into confluentinc:master Oct 19, 2020
@jzaralim jzaralim deleted the alter branch October 19, 2020 20:39
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.

Support ALTER STREAM|TABLE ... ADD COLUMN statement
3 participants