-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-2761] - Neo4j Interpreter #2478
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
Conversation
|
I looked through the code and the UX and can confirm that this is great work from a Neo4j point of view. |
|
Thanks for the great feature! since this is a big change, I guess it takes a time to review and requires multiple reviewers. Let me take a look. |
| * [Lens](./interpreter/lens.html) | ||
| * [Livy](./interpreter/livy.html) | ||
| * [markdown](./interpreter/markdown.html) | ||
| * [Neo4j](./interpreter/neo4j.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add the index into https://github.com/apache/zeppelin/blob/master/docs/_includes/themes/zeppelin/_navigation.html#L138 as well
Otherwise, it will not appear in navbar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| 'bower_components/ace-builds/src-noconflict/mode-python.js', | ||
| 'bower_components/ace-builds/src-noconflict/mode-sql.js', | ||
| 'bower_components/ace-builds/src-noconflict/mode-markdown.js', | ||
| 'bower_components/ace-builds/src-noconflict/mode-pig.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to remove mode-pig.js?
|
This is a new feature that makes utilizing graph type easily. Any other opinions? |
|
@1ambda any update on the review progress? Thanks a lot. |
docs/interpreter/neo4j.md
Outdated
| <div id="toc"></div> | ||
|
|
||
| ## Overview | ||
| [Neo4j](https://neo4j.com/product/) is a native graph database, designed to store and process graphs from bottom to top. On the other hand, non-native solutions only add a shallow graph processing layer to an RDBMS or other NoSQL data stores, resulting in sub-optimal performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part On the other hand, non-native solutions only add a shallow graph processing layer to an RDBMS or other NoSQL data stores, resulting in sub-optimal performance. sounds more like marketing :) think we can drop this from our doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| String username = properties.getProperty(NEO4J_AUTH_USER); | ||
| String password = properties.getProperty(NEO4J_AUTH_PASSWORD); | ||
| LOGGER.debug("Creating a BASIC authentication to neo4j with user '{}' and password '{}'", | ||
| username, password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably shouldn't log password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right, it is my forgetfulness.
Removed
| <script src="bower_components/ace-builds/src-noconflict/mode-python.js"></script> | ||
| <script src="bower_components/ace-builds/src-noconflict/mode-sql.js"></script> | ||
| <script src="bower_components/ace-builds/src-noconflict/mode-markdown.js"></script> | ||
| <script src="bower_components/ace-builds/src-noconflict/mode-pig.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this removed?
| "neo4j.auth.password": { | ||
| "envName": null, | ||
| "propertyName": "neo4j.auth.password", | ||
| "defaultValue": "neo4j", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, would it be better if the default value for password is ""?
| } | ||
| } else if (obj instanceof Map) { | ||
| @SuppressWarnings("unchecked") | ||
| Map<String, Object> map = (Map<String, Object>) obj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need unchecked here?
| public InterpreterResult interpret(String cypherQuery, InterpreterContext interpreterContext) { | ||
| logger.info("Opening session"); | ||
| if (StringUtils.isEmpty(cypherQuery)) { | ||
| return new InterpreterResult(Code.ERROR, "Cypher query is Empty"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you check other interpeters? it might be preferred to do nothing if the query is empty, instead of returning an error
| @Override | ||
| public InterpreterResult interpret(String cypherQuery, InterpreterContext interpreterContext) { | ||
| logger.info("Opening session"); | ||
| if (StringUtils.isEmpty(cypherQuery)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check isBlank instead
| (Apache 2.0) frontend-maven-plugin 1.3 (com.github.eirslett:frontend-maven-plugin:1.3 - https://github.com/eirslett/frontend-maven-plugin/blob/frontend-plugins-1.3/LICENSE | ||
| (Apache 2.0) frontend-plugin-core 1.3 (com.github.eirslett:frontend-plugin-core) - https://github.com/eirslett/frontend-maven-plugin/blob/frontend-plugins-1.3/LICENSE | ||
| (Apache 2.0) mongo-java-driver 3.4.1 (org.mongodb:mongo-java-driver:3.4.1) - https://github.com/mongodb/mongo-java-driver/blob/master/LICENSE.txt | ||
| (Apache 2.0) Neo4j Java Driver (https://github.com/neo4j/neo4j-java-driver) - https://github.com/neo4j/neo4j-java-driver/blob/1.1/LICENSE.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to include neo4j-harness here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @felixcheung ,
in the #1582 Moon said that "...org.neo4j.test:neo4j-harness is 'test' scope and will not bundled into the binary package, we don't need include it in zeppelin-distribution/src/bin_license/LICENSE file..."
Are you sure?
| (Apache 2.0) frontend-maven-plugin 1.3 (com.github.eirslett:frontend-maven-plugin:1.3 - https://github.com/eirslett/frontend-maven-plugin/blob/frontend-plugins-1.3/LICENSE | ||
| (Apache 2.0) frontend-plugin-core 1.3 (com.github.eirslett:frontend-plugin-core) - https://github.com/eirslett/frontend-maven-plugin/blob/frontend-plugins-1.3/LICENSE | ||
| (Apache 2.0) mongo-java-driver 3.4.1 (org.mongodb:mongo-java-driver:3.4.1) - https://github.com/mongodb/mongo-java-driver/blob/master/LICENSE.txt | ||
| (Apache 2.0) Neo4j Java Driver (https://github.com/neo4j/neo4j-java-driver) - https://github.com/neo4j/neo4j-java-driver/blob/1.1/LICENSE.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have version 1.4.0 in the pom file - should we have the same version for license instead of 1.1?
|
@conker84 ping :) |
|
@felixcheung let me know if i have to do something else! |
|
Hi guys, any news/plan about this? |
|
sorry for dropping this. will review shortly. |
|
@felixcheung thank you. We've also received requests from others waiting for this PR :) |
felixcheung
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok LGTM with minor suggestions:
- in the doc example/images/video we should avoid referencing political figures :)
could you please update them? - (optional) shall we move neo4j-java-driver to 1.4.3, and neo4j 3.2.3?
| } | ||
| }, | ||
| "editor": { | ||
| "language": "cypher", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: there is no syntax highlighting support for cypher, so this won't do anything...
|
Sorry for the late response, i lost it :( |
|
Yes please update. |
|
@felixcheung travis is failing, have i to rebase? |
|
Let's try rebasing |
|
I've reviewed the changes |
|
@felixcheung the job #10.2 fails... |
|
@felixcheung ping :) |
|
Hi @felixcheung any news? |
|
could you rebase to pick up the change, I think the test failure is fixed by PR # 2609 |
|
since this is a known failure that is already fixed, let's not restart the process. |
|
yay!! thanks so much. |
|
Thanks! |
|
merged, thanks! |
|
@felixcheung just curious when is the next Zeppelin release planned ? :) |
|
Not sure :)
You can ask on dev@zeppelin.apache.org<mailto:dev@zeppelin.apache.org>
|
What is this PR for?
This contribution would to introduce Neo4j Cypher intepreter and at the same time provides base APIs that enable other graph databases (or graph framworks such as GraphX or Giraph).
What type of PR is it?
[Feature]
Todos
What is the Jira issue?
[ZEPPELIN-2761]
How should this be tested?
Donwload and execute Neo4j v3.x, you can also pull a Docker image.
In order to execute test cases, if you are running Java 7, you need to also provide an environment variable telling the tests where to find Java 8, because Neo4j-the-database needs it to run.
Use this statement to create a dummy dataset
%neo4j UNWIND range(1,100) as id CREATE (p:Person {id:id, name: "Name " + id, age: id % 3}) WITH collect(p) as people UNWIND people as p1 UNWIND range(1,10) as friend WITH p1, people[(p1.id + friend) % size(people)] as p2 CREATE (p1)-[:KNOWS {years: abs(p2.id - p2.id)}]->(p2)Then you can write some simple queries like:
%neo4j MATCH (p:Person)-[r:KNOWS]-(p1:Person) RETURN p, r, p1 LIMIT 10;%neo4j MATCH (p:Person)-[r:KNOWS]-(p1:Person) RETURN p.id AS ID_A, p.name AS NAME_A, r.years AS YEARS, p1.id AS ID_B, p1.name AS NAME_B LIMIT 20;Video
Questions: