环境:
一个MySQL实例,两个schema[ ocuanus、ocuanus2 ],四张表
ocuanus
t_user
ocuanus2
t_user
t_user1
t_user2
表结构与oceanus-test/t_user.sql里面一致
问题1描述:
执行SQL,会出现异常
SELECT AVG(age) FROM t_user u GROUP BY age HAVING age > 20
异常信息:
java.sql.SQLException: Column 'age' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1064)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.findColumn(DelegatingResultSet.java:331)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.findColumn(DelegatingResultSet.java:331)
at com.bj58.oceanus.result.merger.DefaultResultSetMerger$ResultSetColumnFinder.findIndex(DefaultResultSetMerger.java:407)
at com.bj58.oceanus.result.merger.DefaultResultSetMerger.merge(DefaultResultSetMerger.java:121)
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.doQuery(SimpleExecutor.java:184)
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.doQuery(SimpleExecutor.java:148)
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.execute(SimpleExecutor.java:66)
at com.bj58.oceanus.exchange.jdbc.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:102)
at com.bj58.oceanus.demo.UserRwDemo.selectTest(UserRwDemo.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
.....
问题2描述:
执行SQL,会出现异常
SELECT AVG(age), MIN(age), MAX(age), age FROM t_user u
GROUP BY u.age
HAVING u.age > 20
ORDER BY u.age DESC
LIMIT 0, 15
异常信息:
18:10:47.328 [main] ERROR com.bj58.oceanus.result.merger.DefaultResultSetMerger.processHaving(DefaultResultSetMerger.java:254) - script execute error!
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "U" is not defined. (#1) in at line number 1
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156) ~[na:1.6.0_45]
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:170) ~[na:1.6.0_45]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216) ~[na:1.6.0_45]
at com.bj58.oceanus.core.script.InterpretedScriptExecutor.execute(InterpretedScriptExecutor.java:47) ~[oceanus-core-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.result.merger.DefaultResultSetMerger.processHaving(DefaultResultSetMerger.java:250) [oceanus-results-merger-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.result.merger.DefaultResultSetMerger.merge(DefaultResultSetMerger.java:192) [oceanus-results-merger-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.doQuery(SimpleExecutor.java:184) [oceanus-exchange-executors-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.doQuery(SimpleExecutor.java:148) [oceanus-exchange-executors-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.exchange.executors.jdbc.SimpleExecutor.execute(SimpleExecutor.java:66) [oceanus-exchange-executors-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.exchange.jdbc.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:102) [oceanus-exchange-jdbc-0.0.2-SNAPSHOT.jar:na]
at com.bj58.oceanus.demo.UserRwDemo.selectTest(UserRwDemo.java:89) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
.....