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

fix: cannot reference variables in DEFINE statement #6573

Merged
merged 4 commits into from
Nov 16, 2020

Conversation

spena
Copy link
Member

@spena spena commented Nov 4, 2020

Description

Issue: Variables cannot be referenced in the DEFINE statement. i.e.

ksql> define env = 'qa';
ksql> define topicName = 'topic_${env}';
ksql> show variables;

 Variable Name | Value    
--------------------------
 env           | qa       
 topicName     | topic_${env}
--------------------------

This PR fixes the above issue by looking at the VariableValueContext in the VariableSubstitutor, and replace any variables referenced there.

Example:

ksql> define env = 'qa';
ksql> define topicName = 'topic_${env}';
ksql> show variables;

 Variable Name | Value    
--------------------------
 env           | qa       
 topicName     | topic_qa 
--------------------------

Testing done

Added unit tests
Verified manually

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

@spena spena added the bug label Nov 4, 2020
@spena spena requested a review from a team November 4, 2020 16:34
@spena spena requested a review from JimGalasyn as a code owner November 5, 2020 16:00
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, with a couple of suggestions.

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!

@spena spena merged commit ee31fde into confluentinc:master Nov 16, 2020
@spena spena deleted the fix_vars_define branch November 16, 2020 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants