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 SHOW TYPES to list all custom types #3280

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

agavra
Copy link
Contributor

@agavra agavra commented Aug 28, 2019

Description

Pretty straightforward. Allows users to list all of their custom types. Note that nested custom types will show up resolved.

Testing done

  • Unit Testing
  • E2E local testing
ksql> CREATE TYPE PERSON AS STRUCT<name VARCHAR, address ADDRESS>;

 Message
--------------------------------------------------------------------------------------------------------------------------------------------------
 Registered custom type with name 'PERSON' and SQL type STRUCT<`NAME` STRING, `ADDRESS` STRUCT<`NUMBER` INTEGER, `STREET` STRING, `CITY` STRING>>
--------------------------------------------------------------------------------------------------------------------------------------------------
ksql> SHOW TYPES;

 Type Name | Schema
------------------------------------------------------------------------------------------------------------------------
 PERSON    | STRUCT<NAME VARCHAR(STRING), ADDRESS STRUCT<NUMBER INTEGER, STREET VARCHAR(STRING), CITY VARCHAR(STRING)>>
 ADDRESS   | STRUCT<NUMBER INTEGER, STREET VARCHAR(STRING), CITY VARCHAR(STRING)>
------------------------------------------------------------------------------------------------------------------------

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

@agavra agavra requested a review from a team as a code owner August 28, 2019 17:32
@agavra agavra requested review from rodesai and a team August 29, 2019 18:29
Copy link
Contributor

@big-andy-coates big-andy-coates left a comment

Choose a reason for hiding this comment

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

LGTM!


private static final Map<SqlBaseType, Function<SchemaInfo, String>> TO_TYPE_STRING =
ImmutableMap.<SqlBaseType, Function<SchemaInfo, String>>builder()
.put(SqlBaseType.STRING, si -> "VARCHAR(STRING)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just use STRING?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure - I didn't change anything here from what it was previously, but I'll do that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually - this would be a relatively intrusive change to docs and unit tests. I will leave it as is

@agavra agavra merged commit 13fde33 into confluentinc:master Sep 4, 2019
@agavra agavra deleted the show_types branch September 4, 2019 20:00
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.

3 participants