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

[CALCITE-4585]when run RelNode error,Confuse log info be thrown(xiong duan) #2402

Closed
wants to merge 6 commits into from

Conversation

NobiGo
Copy link
Contributor

@NobiGo NobiGo commented Apr 16, 2021

This prepareStatement method capture the exception,But Only the output of SQL exception is processed.When run RelNode
error, The print log is "Error while preparing statement [null]", There is no useful information in this log So need to add the procedure to handle extra Relnode exception.

@NobiGo NobiGo changed the title [CALCITE-4585]when run RelNode or Queryable,Confuse log info be thrown [CALCITE-4585]when run RelNode or Queryable,Confuse log info be thrown(duan xiong) Apr 16, 2021
@NobiGo NobiGo changed the title [CALCITE-4585]when run RelNode or Queryable,Confuse log info be thrown(duan xiong) [CALCITE-4585]when run RelNode or Queryable,Confuse log info be thrown(xiong duan) Apr 16, 2021
Copy link
Member

@hsyuan hsyuan left a comment

Choose a reason for hiding this comment

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

+1

} catch (RuntimeException e) {
assertThat(e.getMessage(),
equalTo("java.sql.SQLException: Error while preparing statement [\n"
+ "LogicalProject($f0=[ABS($1)])\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, the plan may be helpful but it is not a statement ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Statement in Calcite may be include three types: Sql. RelNode . Queryable. This method Called prepareStatement_. My be we listen to others opinion.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I'm +1 for Danny, maybe change "statement" to "plan" is better. But the code before is also "Error while preparing statement"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I will change this to plan. Thanks for all of your advice.

@julianhyde
Copy link
Contributor

We don't generally use System.lineSeparator(); we generally use "\n" in strings. To make the tests pass in Windows, use Matchers.isLinux in your test.

The commit message (and JIRA subject) is not clear. Can you improve it?

I don't think it will be clear to future maintainers what is the purpose of the two test methods. Please add javadoc comments to those methods indicating what you are testing.

@NobiGo NobiGo changed the title [CALCITE-4585]when run RelNode or Queryable,Confuse log info be thrown(xiong duan) [CALCITE-4585]when run RelNode error,Confuse log info be thrown(xiong duan) Apr 26, 2021
@NobiGo
Copy link
Contributor Author

NobiGo commented Apr 26, 2021

Hi, @julianhyde I have try to modify this. Thanks for your advice. This really helped me a lot

@julianhyde
Copy link
Contributor

@NobiGo, I refactored a little in https://github.com/julianhyde/calcite/tree/4585-relRunner-exception, and also fixed related bug https://issues.apache.org/jira/browse/CALCITE-4591. Let me know if there are any objections. I will squash & merge shortly.

@NobiGo
Copy link
Contributor Author

NobiGo commented Apr 27, 2021

@julianhyde CALCITE-4591 makes this issue more complete. I'm +1 for this

julianhyde added a commit to julianhyde/calcite that referenced this pull request Apr 27, 2021
@NobiGo NobiGo deleted the calcite-4585 branch June 8, 2021 02:51
XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Jul 14, 2021
If a query is executed via RelRunner.prepare(RelNode) and
fails, the exception should report the RelNode plan.
Currently it reports the SQL, and for this kind of query,
there is no SQL.

Close apache#2402
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.

6 participants