-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Zeppelin-628 ] Fix parse propertyKey in interpreter name for JDBC #667
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
|
thanks for addressing this. could we add some tests for this? |
|
Hi @felixcheung, thanks for review... |
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.
maybe add trim() because the string could be %jdbc (redshift) select * from...
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 it is not necessary because when I write this query the interpreter what comes is not the name of the interpreter...eg
%jdbc (redshift) select * from...
to string is applied trim in paragraph class...and the interpreter receives this way without spaces
(redshift) select * from...
and finally on line 353 is applied trim to the query....what do you think?
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 presupposes that the end-user will be using the first line as a declaration of the interpreter:
%jdbc (redshift)\n
What about in cases where the user has selected a default interpreter for each paragraph and doesn't need to specify the %<interpreter> prefix? When a user does that then any query with a function will error.
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.
Oops, I see you're checking for startsWith, nevermind.
|
in additional to |
|
I think there is no to change any more...I'm sorry for my english...;) |
|
ok, I'll try to test this out a bit in 1-2 days |
|
Hi @felixcheung, could you check the bug...? |
|
I've tested it a bit, it seems to work - to reproduce the bug, do I need to have multiple, or valid propertyKey? For example, I type a random one and it does not complain: |
|
the problem was when they used the in this way |
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.
Is it a problem if
%jdbc)default(
Or
%jdbc()
Or
%jdbc(
select ....
Or
%jdbc(
default)
select ...
?
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.
Would you be able to address these cases? @vgmartinez
|
Tested the current broken behavior, thanks for fixing this. |
|
@felixcheung I don't think current implementation is good. but I think it's better handle it with different issue. Does it make sense? |
|
property key not matching a valid profile is probably a fix would be great to make separately - would you be interested in that, @vgmartinez ? |
|
Hi @felixcheung @jongyoul something like this: the problem here is that you always have to put the prefix in default or not... |
|
@vgmartinez I think we need to support default interpreter without setting any |
|
agreed, I think |
|
Hi @felixcheung @jongyoul I rebase and push...review please...;) |
|
@vgmartinez it looks like that you merge master into your branch. Please check it and rebase your PR from master again. |
|
@jongyoul...Done |
| assertEquals(t.getPropertyKey("(redshift)\n select max(cant) from test_table where id >= 2452640"), | ||
| "redshift"); | ||
| } | ||
|
|
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.
How about adding what felix mentioned into test cases?
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...add more tests cases....
|
@jongyoul |
|
@vgmartinez could you rebase to latest on master to get Travis tests to run again? |
|
|
||
| // if return null is that prefix not found | ||
| assertEquals(t.getPropertyKey("(fake) select max(cant) from test_table where id >= 2452640"), | ||
| null); |
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.
@vgmartinez I saw the failure and found out the below:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.zeppelin.jdbc.JDBCInterpreterTest
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/travis/build/apache/incubator-zeppelin/zeppelin-interpreter/target/zeppelin-interpreter-0.6.0-incubating-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/travis/build/apache/incubator-zeppelin/zeppelin-interpreter/target/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/travis/.m2/repository/org/slf4j/slf4j-log4j12/1.7.10/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (org.apache.zeppelin.jdbc.JDBCInterpreter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.474 sec <<< FAILURE! - in org.apache.zeppelin.jdbc.JDBCInterpreterTest
testForParsePropertyKey(org.apache.zeppelin.jdbc.JDBCInterpreterTest) Time elapsed: 0.339 sec <<< FAILURE!
java.lang.AssertionError: expected:<fake> but was:<null>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:743)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at org.apache.zeppelin.jdbc.JDBCInterpreterTest.testForParsePropertyKey(JDBCInterpreterTest.java:78)
It needs to fix the test case. It should return fake actually.
|
hi @felixcheung @jongyoul...I have added more test and fix the other |
|
LGTM |
|
looks good, merging if no more comments. |
### What is this PR for? Fix bug https://issues.apache.org/jira/browse/ZEPPELIN-628 ### Todos ### How should this be tested? run a query that contains (something)...eg ``` %jdbc select max(ss_promo_sk), ss_customer_sk from qhive.tpcds_orc_500.store_sales where ss_sold_date_sk >= 2452640 and ss_customer_sk > 3 and ss_customer_sk < 20 group by ss_customer_sk ``` It is ok if the **propertyKey** is default: ``` PropertyKey: default, SQL command: 'select max(ss_promo_sk), ss_customer_sk from qhive.tpcds_orc_500.store_sales where ss_sold_date_sk >= 2452640 and ss_customer_sk > 3 and ss_customer_sk < 20 group by ss_customer_sk' ``` ### Questions: Does the licenses files need update? no Is there breaking changes for older versions? no Does this needs documentation? no Author: vgmartinez <viktor.manuel.garcia@gmail.com> Closes apache#667 from vgmartinez/bug_628 and squashes the following commits: 4859cac [vgmartinez] fix test for parse propertyKey 810c14e [vgmartinez] add more tests for parse prefix 9d59c60 [vgmartinez] fixed parse properties


What is this PR for?
Fix bug
https://issues.apache.org/jira/browse/ZEPPELIN-628
Todos
How should this be tested?
run a query that contains (something)...eg
It is ok if the propertyKey is default:
Questions:
Does the licenses files need update? no
Is there breaking changes for older versions? no
Does this needs documentation? no