Skip to content

Conversation

@sotnich
Copy link

@sotnich sotnich commented Jan 11, 2017

…on + sqlcompleter tests

What is this PR for?

This PR changes autocompletion behaviour in jdbc interpeter.
There are some changes:

  • [main change] autocompletion now depends on what are you typing. Now there are four types of competion: schema, table, column and keywords. If you typing new word then autocompetion suggests only keywords and schema names. If you are typing after schema name with point then you get list of tables in that schema. Also if you typing a name after point after a table name you will get a list of column names of this table.
  • autocomption now supports aliases in sql. If you write alias for a table in sql you will get a list of columns for an aliased table if you write down alias and point.
  • autocompletion now load keywords only in low case (otherwise there are so many keywords in a list of autocompletion that it is becomes uncomfortable)

What type of PR is it?

Improvement

Todos

  • - sort names in the output of autocompletion
  • - list only schema names if we are typing a schema name (for example after keywork FROM)
  • - add description in autocompletion list for schema names - schema, for table names - table and so
  • - autocompletion must initialize on opening of interpeter (not only after execution of sql)
  • - update autocompletion schemas only after execute update sql, not after every sql ???
  • - new option for postgresql interpreter: postgresql.completer.schema.filter. Filter schema names loaded into autocompletion (no more garbage schema names).

What is the Jira issue?

How should this be tested?

Outline the steps to test the PR here.

Screenshots (if appropriate)

https://issues.apache.org/jira/secure/attachment/12845228/auto1.JPG
https://issues.apache.org/jira/secure/attachment/12845229/auto2.JPG
https://issues.apache.org/jira/secure/attachment/12845230/auto3.JPG

Questions:

  • Does the licenses files need update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? Yes

@jongyoul
Copy link
Member

@astroshim Could you please review this PR?

} finally {
schemas.close();
}
} catch (Throwable t) {
Copy link
Member

Choose a reason for hiding this comment

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

Is Exception ok? Should it be Throwable?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, thanks, SQLException is better. Have changed it.

@sotnich
Copy link
Author

sotnich commented Jan 18, 2017

Don't think CI errors are related to this PR.

@@ -0,0 +1,313 @@
package org.apache.zeppelin.jdbc;
Copy link
Member

@jongyoul jongyoul Jan 18, 2017

Choose a reason for hiding this comment

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

You need to add license header into this file.

Unapproved licenses:

  /home/travis/build/apache/zeppelin/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, but still there are erros that I don't understand how to link to PR.

Copy link
Member

@jongyoul jongyoul Jan 20, 2017

Choose a reason for hiding this comment

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

forget my previous message. I got wrong changes

@jongyoul
Copy link
Member

There is a flaky test in the result:

WelcomePageSuite

Never mind the result. that test is being fixed now. LGTM

@jongyoul
Copy link
Member

@sotnich Can you rebase it onto current master? Recently, we fixed some flaky tests including your case. It would make your CI green

@sotnich
Copy link
Author

sotnich commented Jan 30, 2017

Made a rebase, now CI tests have only one error related with DistributedResourcePoolTest.
Think it's still not related to my PR.

@cloverhearts
Copy link
Member

@sotnich
I was test.
LGTM.

I have a question.
Is it possible to only support pgsql? (actually, i am mysql/maria user)

@sotnich
Copy link
Author

sotnich commented Jan 31, 2017

@cloverhearts
Please, clirify your question.
This PR supports every JDBC driver that can return schema and table names.
I have tested it on postgres, but I am sure it would correctly run on mysql and other relational databases.

@astroshim
Copy link
Contributor

@sotnich Thank you for great improvement.
I tested mysql and postgresql and only postgresql is working expectedly like @cloverhearts.

@Leemoonsoo
Copy link
Member

CI failure is not related to this change.
LGTM and merge to master if no further discussion.

@sotnich
Copy link
Author

sotnich commented Feb 2, 2017

@cloverhearts @astroshim
Made a little change - now mysql also works as well as postgresql. I have tested it.

@astroshim
Copy link
Contributor

@sotnich Great Job! but still doesn't work with mysql.

@cloverhearts
Copy link
Member

auto-com

Hello, I was check again.
but, does not work on mysql.
Is there anything I missed?

@sotnich
Copy link
Author

sotnich commented Feb 9, 2017

@cloverhearts @astroshim, check it now, please. If it's still not working send me details: configuration of the interpreter and jdbc log file.

@cloverhearts
Copy link
Member

@sotnich
now Well working!
good works!
Thank you for great feature!

mysql

@Leemoonsoo
Copy link
Member

LGTM and merge to master if no more discussions.

@asfgit asfgit closed this in b579a64 Feb 11, 2017
prabhjyotsingh added a commit to prabhjyotsingh/zeppelin that referenced this pull request Sep 1, 2017
…on + sqlcompleter tests

### What is this PR for?
This PR changes autocompletion behaviour in jdbc interpeter.
There are some changes:
* [main change] autocompletion now depends on what are you typing. Now there are four types of competion: schema, table, column and keywords. If you typing new word then autocompetion suggests only keywords and schema names. If you are typing after schema name with point then you get list of tables in that schema. Also if you typing a name after point after a table name you will get a list of column names of this table.
* autocomption now supports aliases in sql. If you write alias for a table in sql you will get a list of columns for an aliased table if you write down alias and point.
* autocompletion now load keywords only in low case (otherwise there are so many keywords in a list of autocompletion that it is becomes uncomfortable)

### What type of PR is it?
Improvement

### Todos
* [ ] - sort names in the output of autocompletion
* [ ] - list only schema names if we are typing a schema name (for example after keywork FROM)
* [ ] - add description in autocompletion list for schema names - schema, for table names - table and so
* [ ] - autocompletion must initialize on opening of interpeter (not only after execution of sql)
* [ ] - update autocompletion schemas only after execute update sql, not after every sql ???
* [ ] - new option for postgresql interpreter: postgresql.completer.schema.filter. Filter schema names loaded into autocompletion (no more garbage schema names).

### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
* Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]

### How should this be tested?
Outline the steps to test the PR here.

### Screenshots (if appropriate)
https://issues.apache.org/jira/secure/attachment/12845228/auto1.JPG
https://issues.apache.org/jira/secure/attachment/12845229/auto2.JPG
https://issues.apache.org/jira/secure/attachment/12845230/auto3.JPG

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? Yes

Author: Sotnichenko Sergey <[email protected]>

Closes apache#1886 from sotnich/jdbc-1876 and squashes the following commits:

2db7ed8 [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
a048ef2 [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
f4b03df [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
675c629 [Sotnichenko Sergey] [ZEPPELIN-1876] Adding licence header
9fac1d0 [Sotnichenko Sergey] [ZEPPELIN-1876] SQLException instead of Throwable
895c35a [Sotnichenko Sergey] [ZEPPELIN-1876] SQLException instead of Throwable
7d40166 [Sotnichenko Sergey] [ZEPPELIN-1876] improved comptetion with schema/table/column separation + sqlcompleter tests
prabhjyotsingh added a commit to prabhjyotsingh/zeppelin that referenced this pull request Oct 23, 2017
…on + sqlcompleter tests

### What is this PR for?
This PR changes autocompletion behaviour in jdbc interpeter.
There are some changes:
* [main change] autocompletion now depends on what are you typing. Now there are four types of competion: schema, table, column and keywords. If you typing new word then autocompetion suggests only keywords and schema names. If you are typing after schema name with point then you get list of tables in that schema. Also if you typing a name after point after a table name you will get a list of column names of this table.
* autocomption now supports aliases in sql. If you write alias for a table in sql you will get a list of columns for an aliased table if you write down alias and point.
* autocompletion now load keywords only in low case (otherwise there are so many keywords in a list of autocompletion that it is becomes uncomfortable)

### What type of PR is it?
Improvement

### Todos
* [ ] - sort names in the output of autocompletion
* [ ] - list only schema names if we are typing a schema name (for example after keywork FROM)
* [ ] - add description in autocompletion list for schema names - schema, for table names - table and so
* [ ] - autocompletion must initialize on opening of interpeter (not only after execution of sql)
* [ ] - update autocompletion schemas only after execute update sql, not after every sql ???
* [ ] - new option for postgresql interpreter: postgresql.completer.schema.filter. Filter schema names loaded into autocompletion (no more garbage schema names).

### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
* Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]

### How should this be tested?
Outline the steps to test the PR here.

### Screenshots (if appropriate)
https://issues.apache.org/jira/secure/attachment/12845228/auto1.JPG
https://issues.apache.org/jira/secure/attachment/12845229/auto2.JPG
https://issues.apache.org/jira/secure/attachment/12845230/auto3.JPG

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? Yes

Author: Sotnichenko Sergey <[email protected]>

Closes apache#1886 from sotnich/jdbc-1876 and squashes the following commits:

2db7ed8 [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
a048ef2 [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
f4b03df [Sotnichenko Sergey] [ZEPPELIN-1876] add support for databases with only catalogs without schemas (like mysql)
675c629 [Sotnichenko Sergey] [ZEPPELIN-1876] Adding licence header
9fac1d0 [Sotnichenko Sergey] [ZEPPELIN-1876] SQLException instead of Throwable
895c35a [Sotnichenko Sergey] [ZEPPELIN-1876] SQLException instead of Throwable
7d40166 [Sotnichenko Sergey] [ZEPPELIN-1876] improved comptetion with schema/table/column separation + sqlcompleter tests
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