Skip to content

[Bug] The operator on single Sql has affected the session varaiables#5620

Merged
yangzhg merged 29 commits intoapache:masterfrom
Userwhite:master
Apr 30, 2021
Merged

[Bug] The operator on single Sql has affected the session varaiables#5620
yangzhg merged 29 commits intoapache:masterfrom
Userwhite:master

Conversation

@Userwhite
Copy link
Contributor

@Userwhite Userwhite commented Apr 9, 2021

Proposed changes

  1. record the modified session value's initial value.
  2. when the sql's execute has finished,set session value to initial value.
  3. if it is the set Stmt, won't do step 1、2.

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have created an issue on (Fix [Bug] SET_VAR in a single sql affects the Session value #5570 ) and described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • If these changes need document changes, I have updated the document
  • Any dependent changes have been merged

@Userwhite Userwhite closed this Apr 9, 2021
@Userwhite Userwhite reopened this Apr 9, 2021

// origin value init
VariableMgr.setIsSingleSetVar(false);
VariableMgr.clearMapSessionOriginValue();
Copy link
Contributor

@morningman morningman Apr 14, 2021

Choose a reason for hiding this comment

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

VariableMgr is not a thread safe class.
But execute() can be called by multi threads

Copy link
Contributor

Choose a reason for hiding this comment

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

So isSingleSetVar and sessionOriginValue should be set in SessionVariables instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it and Fixed. sorry for my fault.

public static final long MIN_INSERT_VISIBLE_TIMEOUT_MS = 1000; // If user set a very small value, use this value instead.

// session origin value
public static final Map<Field, String> sessionOriginValue = new HashMap<Field, String>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why using static?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Apr 29, 2021
@yangzhg yangzhg merged commit f570e96 into apache:master Apr 30, 2021
EmmyMiao87 pushed a commit to EmmyMiao87/incubator-doris that referenced this pull request May 14, 2021
Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Nov 12, 2025
…alog read project-schema-table. apache#57012 (apache#5620)

cherry-picks from apache#57012
Related to apache#5289

Co-authored-by: daidai <changyuwei@selectdb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. good first issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SET_VAR in a single sql affects the Session value

3 participants