Randy Gelhausen created ZEPPELIN-2241:
-----------------------------------------
Summary: JDBC interpreter throws npe on connecting to any db that
has a schema with "null" name
Key: ZEPPELIN-2241
URL: https://issues.apache.org/jira/browse/ZEPPELIN-2241
Project: Zeppelin
Issue Type: Bug
Components: Interpreters
Reporter: Randy Gelhausen
Assignee: Randy Gelhausen
For example, Apache Phoenix has a default schema without a name. Any JDBC
command will throw a stacktrace on attempting to setup SQLCompleter's treemap.
I added logger statements to demonstrate the problem below:
INFO [2017-03-09 23:38:57,894] ({pool-2-thread-2}
SqlCompleter.java[initFromConnection]:363) - Completer initialized with 0
schemas, 0 tables and 281 keywords
INFO [2017-03-09 23:38:57,896] ({pool-2-thread-2}
JDBCInterpreter.java[interpret]:694) - Run SQL command 'select * from
system.catalog'
INFO [2017-03-09 23:38:57,896] ({pool-2-thread-2}
JDBCInterpreter.java[interpret]:703) - PropertyKey: default, SQL command:
'select * from system.catalog'
INFO [2017-03-09 23:38:58,445] ({pool-2-thread-2}
SqlCompleter.java[getSqlKeywordsCompletions]:219) - JDBC
DriverName:/phoenix-remote-jdbc-driver-sql.keywords
INFO [2017-03-09 23:38:58,526] ({pool-2-thread-2}
SqlCompleter.java[getSchemaNames]:114) - FOUND SCHEMA: null
INFO [2017-03-09 23:38:58,526] ({pool-2-thread-2}
SqlCompleter.java[getSchemaNames]:114) - FOUND SCHEMA: SYSTEM
INFO [2017-03-09 23:38:58,668] ({pool-2-thread-2}
SqlCompleter.java[initSchemas]:280) - Connection has 2 schemas
INFO [2017-03-09 23:38:58,668] ({pool-2-thread-2}
SqlCompleter.java[initSchemas]:281) - [null, SYSTEM]
ERROR [2017-03-09 23:38:58,669] ({pool-2-thread-2}
JDBCInterpreter.java[executeSql]:642) - Cannot run select * from system.catalog
java.lang.NullPointerException
at java.util.TreeMap.compare(TreeMap.java:1290)
at java.util.TreeMap.put(TreeMap.java:538)
at java.util.TreeSet.add(TreeSet.java:255)
at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
at java.util.TreeSet.addAll(TreeSet.java:312)
at java.util.TreeSet.<init>(TreeSet.java:160)
at
org.apache.zeppelin.jdbc.SqlCompleter.initSchemas(SqlCompleter.java:283)
at org.apache.zeppelin.jdbc.SqlCompleter.init(SqlCompleter.java:322)
at
org.apache.zeppelin.jdbc.SqlCompleter.initFromConnection(SqlCompleter.java:362)
at
org.apache.zeppelin.jdbc.JDBCInterpreter.createSqlCompleter(JDBCInterpreter.java:209)
at
org.apache.zeppelin.jdbc.JDBCInterpreter.getConnection(JDBCInterpreter.java:424)
at
org.apache.zeppelin.jdbc.JDBCInterpreter.executeSql(JDBCInterpreter.java:576)
at
org.apache.zeppelin.jdbc.JDBCInterpreter.interpret(JDBCInterpreter.java:704)
at
org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:94)
at
org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:495)
at org.apache.zeppelin.scheduler.Job.run(Job.java:181)
at
org.apache.zeppelin.scheduler.ParallelScheduler$JobRunner.run(ParallelScheduler.java:162)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)