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

Improve error for unsupported result type. #2585

Merged
merged 1 commit into from
Sep 21, 2015
Merged

Conversation

vivekmenezes
Copy link
Contributor

No description provided.

@@ -206,8 +206,10 @@ func (e Executor) execStmt(stmt parser.Statement, params parameters, planMaker *
row.Values = append(row.Values, driver.Datum{
Payload: &driver.Datum_IntervalVal{IntervalVal: vt.Nanoseconds()},
})
case parser.DTuple:
return fmt.Errorf("unsupported result type: tuple, remove extra parenthesis around column %s", result.Columns[i])
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think this advice is appropriate. other databases support the tuple return; it's fine that we do not, but this advice is inappropriate because it changes the semantics. The new verbiage in the default clause LGTM.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed that the advice is inappropriate. I think we should have a specific error message for trying to return a tuple. Something like: "unsupported tuple result".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want folks to see parser.DTuple, and I much prefer having error messages provide guidance on what to do. Should I say "you might want to remove the extra..."

Copy link
Contributor

Choose a reason for hiding this comment

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

@vivekmenezes you can get "tuple" instead of "parser.DTuple" by calling Type() on the datum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to what Tamir suggests. You are sure you don't want the recommendation "you might want to remove..." right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I suppose with "tuple" it's probably good enough. Changing

@vivekmenezes vivekmenezes changed the title Improve error for unsupported tuple result Improve error for unsupported result type. Sep 21, 2015
@tbg
Copy link
Member

tbg commented Sep 21, 2015

LGTM

vivekmenezes added a commit that referenced this pull request Sep 21, 2015
Improve error for unsupported result type.
@vivekmenezes vivekmenezes merged commit 88ef0ca into master Sep 21, 2015
@vivekmenezes vivekmenezes deleted the vivek/distinct-fix branch September 21, 2015 17:25
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.

4 participants