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

chore: decouple CLI from ROWKEY #4929

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-md/developer-guide/create-a-stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Name : PAGEVIEWS
Field | Type
--------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
VIEWTIME | BIGINT
USERID | VARCHAR(STRING)
PAGEID | VARCHAR(STRING)
Expand Down
2 changes: 1 addition & 1 deletion docs-md/developer-guide/create-a-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Name : USERS
Field | Type
------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
USERID | VARCHAR(STRING)
GENDER | VARCHAR(STRING)
Expand Down
4 changes: 2 additions & 2 deletions docs-md/developer-guide/ksqldb-reference/describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Your output should resemble:
Field | Type
-------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
IP | VARCHAR(STRING) (key)
KBYTES | BIGINT
-------------------------------------
Expand All @@ -83,7 +83,7 @@ Kafka output topic : IP_SUM (partitions: 4, replication: 1)
Field | Type
-------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
IP | VARCHAR(STRING) (key)
KBYTES | BIGINT
-------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs-md/developer-guide/query-with-structured-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Name : TYPE_1
Field | Type
-------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
DATA__field-a | INTEGER
DATA__field-b | VARCHAR(STRING)
-------------------------------------------
Expand All @@ -296,7 +296,7 @@ Name : TYPE_2
Field | Type
-------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
DATA__field-a | INTEGER
DATA__field-c | INTEGER
DATA__field-d | VARCHAR(STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Name : ORDERS_RAW
Field | Type
----------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
ITEMID | VARCHAR(STRING)
PRICE | DOUBLE
LOCATION | STRUCT<CITY VARCHAR(STRING), STATE VARCHAR(STRING), ZIPCODE INTEGER>
Expand Down Expand Up @@ -187,7 +187,7 @@ Name : USERS_ORIGINAL
Field | Type
------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
Expand Down Expand Up @@ -243,7 +243,7 @@ Name : USERS_EXTENDED
Field | Type
---------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
Expand Down Expand Up @@ -297,7 +297,7 @@ Name : PAGEVIEWS_ORIGINAL
Field | Type
--------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
VIEWTIME | BIGINT
USERID | VARCHAR(STRING)
PAGEID | VARCHAR(STRING)
Expand Down
2 changes: 1 addition & 1 deletion docs-md/developer-guide/test-and-debug/processing-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Name : PROCESSING_LOG
Field | Type
---------------------------------------------------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
LOGGER | VARCHAR(STRING)
LEVEL | VARCHAR(STRING)
TIME | BIGINT
Expand Down
2 changes: 1 addition & 1 deletion docs-md/tutorials/basics-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ EMIT CHANGES;
Field | Type
--------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system) (Window type: TUMBLING)
ROWKEY | VARCHAR(STRING) (key) (Window type: TUMBLING)
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
NUMUSERS | BIGINT
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/create-a-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Your output should resemble:
Field | Type
--------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
VIEWTIME | BIGINT
USERID | VARCHAR(STRING)
PAGEID | VARCHAR(STRING)
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/create-a-table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Your output should resemble:
Field | Type
------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
USERID | VARCHAR(STRING)
GENDER | VARCHAR(STRING)
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/processing-log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ When you start KSQL, you should see the stream in your list of streams:
Field | Type
---------------------------------------------------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
LOGGER | VARCHAR(STRING)
LEVEL | VARCHAR(STRING)
TIME | BIGINT
Expand Down
4 changes: 2 additions & 2 deletions docs/developer-guide/query-with-structured-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Your output should resemble:
Field | Type
-------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
DATA__field-a | INTEGER
DATA__field-b | VARCHAR(STRING)
-------------------------------------------
Expand All @@ -289,7 +289,7 @@ Your output should resemble:
Field | Type
-------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
DATA__field-a | INTEGER
DATA__field-c | INTEGER
DATA__field-d | VARCHAR(STRING)
Expand Down
4 changes: 2 additions & 2 deletions docs/developer-guide/syntax-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ Your output should resemble:
Field | Type
-------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
IP | VARCHAR(STRING) (key)
KBYTES | BIGINT
-------------------------------------
Expand All @@ -1090,7 +1090,7 @@ Your output should resemble:
Field | Type
-------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
IP | VARCHAR(STRING) (key)
KBYTES | BIGINT
-------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/includes/ksql-includes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ the latest offset.
Field | Type
--------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
NUMUSERS | BIGINT
Expand Down Expand Up @@ -563,7 +563,7 @@ Your output should resemble:
Field | Type
----------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
ORDERTIME | BIGINT
ORDERID | INTEGER
ITEMID | VARCHAR(STRING)
Expand Down Expand Up @@ -869,7 +869,7 @@ Your output should resemble:
Field | Type
----------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
SRC | VARCHAR(STRING)
ORDERTIME | BIGINT
ORDERID | INTEGER
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/generate-custom-test-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Your output should resemble:
Field | Type
----------------------------------------------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
ITEMID | VARCHAR(STRING)
PRICE | DOUBLE
LOCATION | STRUCT<CITY VARCHAR(STRING), STATE VARCHAR(STRING), ZIPCODE INTEGER>
Expand Down Expand Up @@ -188,7 +188,7 @@ Your output should resemble:
Field | Type
------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
Expand Down Expand Up @@ -243,7 +243,7 @@ Your output should resemble:
Field | Type
---------------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
REGISTERTIME | BIGINT
GENDER | VARCHAR(STRING)
REGIONID | VARCHAR(STRING)
Expand Down Expand Up @@ -295,7 +295,7 @@ Your output should resemble:
Field | Type
--------------------------------------
ROWTIME | BIGINT (system)
ROWKEY | VARCHAR(STRING) (system)
ROWKEY | VARCHAR(STRING) (key)
VIEWTIME | BIGINT
USERID | VARCHAR(STRING)
PAGEID | VARCHAR(STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import io.confluent.ksql.rest.entity.ErrorEntity;
import io.confluent.ksql.rest.entity.ExecutionPlan;
import io.confluent.ksql.rest.entity.FieldInfo;
import io.confluent.ksql.rest.entity.FieldInfo.FieldType;
import io.confluent.ksql.rest.entity.FunctionDescriptionList;
import io.confluent.ksql.rest.entity.FunctionInfo;
import io.confluent.ksql.rest.entity.FunctionNameList;
Expand Down Expand Up @@ -85,7 +86,6 @@
import io.confluent.ksql.util.HandlerMaps.ClassHandlerMap1;
import io.confluent.ksql.util.HandlerMaps.Handler1;
import io.confluent.ksql.util.KsqlException;
import io.confluent.ksql.util.SchemaUtil;
import io.confluent.ksql.util.TabularRow;
import java.io.Closeable;
import java.io.File;
Expand Down Expand Up @@ -455,16 +455,18 @@ private static String formatFieldType(
final Optional<WindowType> windowType,
final String keyField
) {
if (field.getName().equals(SchemaUtil.ROWTIME_NAME.text())) {
final FieldType possibleFieldType = field.getType().orElse(null);

if (possibleFieldType == FieldType.SYSTEM) {
return String.format("%-16s %s", field.getSchema().toTypeString(), "(system)");
}

if (field.getName().equals(SchemaUtil.ROWKEY_NAME.text())) {
if (possibleFieldType == FieldType.KEY) {
final String wt = windowType
.map(v -> " (Window type: " + v + ")")
.orElse("");

return String.format("%-16s %s%s", field.getSchema().toTypeString(), "(system)", wt);
return String.format("%-16s %s%s", field.getSchema().toTypeString(), "(key)", wt);
}

if (keyField != null && keyField.contains("." + field.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public void shouldPrintCorrectSchemaForDescribeStream() {
"describe " + ORDER_DATA_PROVIDER.kstreamName() + ";",
containsRows(
row("ROWTIME", "BIGINT (system)"),
row("ROWKEY", "BIGINT (system)"),
row("ROWKEY", "BIGINT (key)"),
row("ORDERTIME", "BIGINT"),
row("ORDERID", "VARCHAR(STRING)"),
row("ITEMID", "VARCHAR(STRING)"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,16 @@ public void testPrintSourceDescription() {
+ " \"type\" : \"BIGINT\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"SYSTEM\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"ROWKEY\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
+ " \"type\" : \"STRING\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"KEY\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"f_0\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
Expand Down Expand Up @@ -505,7 +507,7 @@ public void testPrintSourceDescription() {
+ " Field | Type " + NEWLINE
+ "-------------------------------------" + NEWLINE
+ " ROWTIME | BIGINT (system) " + NEWLINE
+ " ROWKEY | VARCHAR(STRING) (system) " + NEWLINE
+ " ROWKEY | VARCHAR(STRING) (key) " + NEWLINE
+ " f_0 | BOOLEAN " + NEWLINE
+ " f_1 | INTEGER " + NEWLINE
+ " f_2 | BIGINT " + NEWLINE
Expand Down Expand Up @@ -607,14 +609,16 @@ public void testPrintConnectorDescription() {
+ " \"type\" : \"BIGINT\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"SYSTEM\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"ROWKEY\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
+ " \"type\" : \"STRING\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"KEY\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"f_0\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
Expand Down Expand Up @@ -915,7 +919,7 @@ public void shouldPrintTypesList() {
"typeA", new SchemaInfo(
SqlBaseType.STRUCT,
ImmutableList.of(
new FieldInfo("f1", new SchemaInfo(SqlBaseType.STRING, null, null))),
new FieldInfo("f1", new SchemaInfo(SqlBaseType.STRING, null, null), Optional.empty())),
null)
))
));
Expand Down Expand Up @@ -1059,14 +1063,16 @@ public void shouldPrintTopicDescribeExtended() {
+ " \"type\" : \"BIGINT\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"SYSTEM\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"ROWKEY\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
+ " \"type\" : \"STRING\"," + NEWLINE
+ " \"fields\" : null," + NEWLINE
+ " \"memberSchema\" : null" + NEWLINE
+ " }" + NEWLINE
+ " }," + NEWLINE
+ " \"type\" : \"KEY\"" + NEWLINE
+ " }, {" + NEWLINE
+ " \"name\" : \"f_0\"," + NEWLINE
+ " \"schema\" : {" + NEWLINE
Expand Down Expand Up @@ -1104,7 +1110,7 @@ public void shouldPrintTopicDescribeExtended() {
+ " Field | Type " + NEWLINE
+ "-------------------------------------" + NEWLINE
+ " ROWTIME | BIGINT (system) " + NEWLINE
+ " ROWKEY | VARCHAR(STRING) (system) " + NEWLINE
+ " ROWKEY | VARCHAR(STRING) (key) " + NEWLINE
+ " f_0 | VARCHAR(STRING) " + NEWLINE
+ "-------------------------------------" + NEWLINE
+ "" + NEWLINE
Expand Down
Loading