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: klip-14 - rowtime as pseduocolumn #5150

Conversation

big-andy-coates
Copy link
Contributor

Description

fixes: #3734

implements KLIP 14 - ROWTIME as Pseudocolumn

BREAKING CHANGE:

Select star, i.e. select *, no longer expands to include ROWTIME column(s). Instead, ROWTIME is only included in the results of queries if explicitly included in the projection, e.g. select rowtime, *.

This only affects new statements. Any view previously created via a CREATE STREAM AS SELECT or CREATE TABLE AS SELECT statement is unaffected.

Reviewing notes:

PR broken down into separate commits:

  1. Prod changes
  2. Test changes
  3. Historical plan updates
  4. Doc changes
  5. Update to KLIP-14

Testing done

usual.

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 #")

fixes: confluentinc#3734

implements [KLIP 14 - ROWTIME as Pseudocolumn](https://github.com/confluentinc/ksql/blob/master/design-proposals/klip-14-rowtime-as-pseudocolumn.md)

BREAKING CHANGE:

Select star, i.e. `select *`, no longer expands to include `ROWTIME` column(s). Instead, `ROWTIME` is only included in the results of queries if explicitly included in the projection, e.g. `select rowtime, *`.

This only affects new statements. Any view previously created via a `CREATE STREAM AS SELECT` or `CREATE TABLE AS SELECT` statement is unaffected.
@big-andy-coates big-andy-coates requested review from JimGalasyn and a team as code owners April 23, 2020 11:22
@@ -30,7 +30,8 @@
public class FieldInfo {

public enum FieldType {
SYSTEM, KEY
SYSTEM, // To be removed in the future. 0.9 saw this value no longer used.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kept SYSTEM around for now, so that using a later CLI with old server doesn't result in a deserialization error.

Not strictly necessary, but simple to do.

@@ -39,6 +40,7 @@ private EntityUtil() {

public static List<FieldInfo> buildSourceSchemaEntity(final LogicalSchema schema) {
final List<FieldInfo> allFields = schema.columns().stream()
.filter(f -> f.namespace() != Namespace.META)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This filters ROWTIME from the schema returned by DESCRIBE etc.

@@ -55,7 +55,6 @@ public static LogicalSchema buildSchema(
}

return builder
.valueColumns(schema.metadata())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes remove ROWTIME from pull queries that use select *.

Comment on lines +150 to +161
final Stream<Column> keys = columns.stream()
.filter(c -> schema.isKeyColumn(c.name()));

final List<Column> all = partitioned.get(true);
all.addAll(partitioned.get(false));
return all.stream().map(Column::name);
final Stream<Column> windowBounds = columns.stream()
.filter(c -> SchemaUtil.isWindowBound(c.name()));

final Stream<Column> values = columns.stream()
.filter(c -> !SchemaUtil.isWindowBound(c.name()))
.filter(c -> !schema.isKeyColumn(c.name()))
.filter(c -> !schema.isMetaColumn(c.name()));

return Streams.concat(keys, windowBounds, values).map(Column::name);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change excludes ROWTIME from push / persistent queries that use * in the projection.

Conflicting files
ksqldb-rest-app/src/test/java/io/confluent/ksql/rest/server/resources/streaming/WebSocketSubscriberTest.java
Conflicting files
ksqldb-engine/src/test/java/io/confluent/ksql/planner/plan/DataSourceNodeTest.java
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!

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, thanks for the update!

@big-andy-coates big-andy-coates merged commit d541420 into confluentinc:master Apr 23, 2020
@big-andy-coates big-andy-coates deleted the drop_rowtime_from_select_star branch April 23, 2020 23:53
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.

Define Access Pattern for Metadata Fields
3 participants