Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

error in join tables from two datasources #35

Open
superpiggy opened this issue Dec 30, 2015 · 1 comment
Open

error in join tables from two datasources #35

superpiggy opened this issue Dec 30, 2015 · 1 comment

Comments

@superpiggy
Copy link
Contributor

I couldn't execute the join query for two datasources (which are actually mysql DBs).
logs in octopus.log are as follows.

2015-12-30 15:45:41,943 DEBUG kr.co.bitnine.octopus.engine.QueryEngine: FQN translated: SELECT ename, dname
FROM bb.sample.emp,
aa.sample.dept
WHERE emp.ename = dept.dname
2015-12-30 15:45:41,952 INFO kr.co.bitnine.octopus.engine.QueryEngine: Generated plan:
LogicalProject(ename=[$3], dname=[$10]): rowcount = 1500.0, cumulative cost = {13200.0 rows, 13202.0 cpu, 0.0 io}, id = 262
LogicalFilter(condition=[=($3, $10)]): rowcount = 1500.0, cumulative cost = {11700.0 rows, 10202.0 cpu, 0.0 io}, id = 261
LogicalJoin(condition=[true], joinType=[inner]): rowcount = 10000.0, cumulative cost = {10200.0 rows, 202.0 cpu, 0.0 io}, id = 260
JdbcTableScan(table=[[bb, sample, emp]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 258
JdbcTableScan(table=[[aa, sample, dept]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 259

2015-12-30 15:45:41,953 DEBUG kr.co.bitnine.octopus.frame.Session: extended query sub-protocol message
2015-12-30 15:45:41,953 DEBUG kr.co.bitnine.octopus.frame.Session: handle Bind message (portal=, stmt=)
2015-12-30 15:45:41,953 DEBUG kr.co.bitnine.octopus.engine.QueryEngine: complex query: SELECT emp.ename, dept.dname
FROM bb.sample.emp AS emp,
aa.sample.dept AS dept
WHERE emp.ename = dept.dname
2015-12-30 15:45:41,953 INFO kr.co.bitnine.octopus.engine.QueryEngine: create portal '' for by-pass (session=1351644949)
2015-12-30 15:45:41,954 DEBUG kr.co.bitnine.octopus.frame.Session: extended query sub-protocol message
2015-12-30 15:45:41,954 DEBUG kr.co.bitnine.octopus.frame.Session: handle Describe message (type='P', name=)
2015-12-30 15:45:41,954 INFO kr.co.bitnine.octopus.engine.CursorByPass: Avatica JDBC connection for session(1351644949)
2015-12-30 15:45:42,107 DEBUG kr.co.bitnine.octopus.engine.CursorByPass: execute CursorByPass (rows=0)
2015-12-30 15:45:42,115 INFO kr.co.bitnine.octopus.engine.CursorByPass: return connection to "null" for session(1351644949)
2015-12-30 15:45:42,115 ERROR kr.co.bitnine.octopus.frame.Session: kr.co.bitnine.octopus.frame.OctopusException: failed to execute by-pass query: null
at kr.co.bitnine.octopus.frame.Session.handleDescribe(Session.java:758)
at kr.co.bitnine.octopus.frame.Session.messageLoop(Session.java:367)
at kr.co.bitnine.octopus.frame.Session.run(Session.java:114)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: kr.co.bitnine.octopus.postgres.utils.PostgresException: failed to execute by-pass query: null
at kr.co.bitnine.octopus.engine.CursorByPass.execute(CursorByPass.java:253)
at kr.co.bitnine.octopus.engine.CursorByPass.describe(CursorByPass.java:260)
at kr.co.bitnine.octopus.frame.Session.handleDescribe(Session.java:739)
... 5 more
Caused by: java.sql.SQLException
at org.apache.calcite.avatica.Helper.createException(Helper.java:52)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:473)
at org.apache.calcite.avatica.AvaticaPreparedStatement.executeQuery(AvaticaPreparedStatement.java:111)
at kr.co.bitnine.octopus.engine.CursorByPass.execute(CursorByPass.java:224)
... 7 more
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.(BigDecimal.java:470)
at java.math.BigDecimal.(BigDecimal.java:739)
at org.mariadb.jdbc.internal.common.AbstractValueObject.getInt(AbstractValueObject.java:111)
at org.mariadb.jdbc.MySQLResultSet.getInt(MySQLResultSet.java:135)
at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215)
at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215)
at Baz$1$1$1$1.apply(Unknown Source)
at org.apache.calcite.runtime.ResultSetEnumerable$ResultSetEnumerator.current(ResultSetEnumerable.java:182)
at Baz$1$1.current(Unknown Source)
at org.apache.calcite.linq4j.EnumerableDefaults.toLookup_(EnumerableDefaults.java:2579)
at org.apache.calcite.linq4j.EnumerableDefaults.toLookup(EnumerableDefaults.java:2570)
at org.apache.calcite.linq4j.EnumerableDefaults.toLookup(EnumerableDefaults.java:2546)
at org.apache.calcite.linq4j.DefaultEnumerable.toLookup(DefaultEnumerable.java:701)
at org.apache.calcite.linq4j.EnumerableDefaults$10.enumerator(EnumerableDefaults.java:1086)
at org.apache.calcite.linq4j.AbstractEnumerable.iterator(AbstractEnumerable.java:33)
at kr.co.bitnine.octopus.engine.calcite.CalciteMetaImpl.execute(CalciteMetaImpl.java:628)
at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:463)
... 9 more

Similary, I failed to run a testcase for join query (SessionServerTest#testComplexSelect)

2015-12-30 16:12:38,118 INFO engine.QueryEngine (QueryEngine.java:processBind(334)) - create portal '' for by-pass (session=1079759576)
2015-12-30 16:12:38,125 INFO engine.CursorByPass (CursorByPass.java:prepareStatement(106)) - Avatica JDBC connection for session(1079759576)





data.__DEFAULT.employee
employee





SELECT id, name
FROM employee
SELECT id, name
FROM employee





DATA2.__DEFAULT.TMP2
TMP2
2015-12-30 16:12:38,677 INFO engine.CursorByPass (CursorByPass.java:execute(233)) - JDBC type of column 'name' is 12
2015-12-30 16:12:38,678 INFO frame.Session (Session.java:handleExecute(645)) - run portal ''
2015-12-30 16:12:38,681 ERROR frame.Session (Session.java:run(117)) - java.lang.UnsupportedOperationException
at org.apache.calcite.avatica.AvaticaResultSet.cancel(AvaticaResultSet.java:171)
at org.apache.calcite.avatica.AvaticaStatement.cancel(AvaticaStatement.java:299)
at kr.co.bitnine.octopus.engine.CursorByPass.close(CursorByPass.java:288)
at kr.co.bitnine.octopus.frame.Session.handleExecute(Session.java:661)
at kr.co.bitnine.octopus.frame.Session.messageLoop(Session.java:361)
at kr.co.bitnine.octopus.frame.Session.run(Session.java:114)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

2015-12-30 16:12:38,681 INFO engine.CursorByPass (CursorByPass.java:close(300)) - return connection to "null" for session(1079759576)

@dreamtheater0
Copy link

This issue contains two errors caused by different reasons.

The first error seems to be due to mis-allocating type information for referred columms in the query.
The example query is as follows;

SELECT ename, dname
FROM bb.sample.emp,
aa.sample.dept
WHERE emp.ename = dept.dname

Calcite complains that it cann't transfer designated column into BigDecimal type because of invalid format.
However, we can see that the above query has no integer columns by inferring from their name: ename and dname.
So we can conclude that there are mis-assigning of the type information for columns.

I'll look further this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants