[
https://issues.jboss.org/browse/TEIID-2134?page=com.atlassian.jira.plugin...
]
Hisanobu Okuda commented on TEIID-2134:
---------------------------------------
DF.V.TYPES view in the attached vdb is defined by select literal query:-
{code}
SELECT
'OL' AS code, 'manual' AS category
UNION
SELECT
'CP' AS code, 'copy' AS category
UNION
SELECT
'OC' AS code, 'conversion' AS category
UNION
SELECT
'BC' AS code, 'electronic' AS category
UNION
SELECT
'BCMA' AS code, 'paper' AS category
{code}
This makes `stats` in NewCalculateCostUtil#setColStatEstimates null.
{code}
423 } else if (setOp != null) {
424 //set op
425 float[] stats = colStats.get(expr);
426 float[] statsOther =
colStatsOther.get(outputColsOther.get(i));
427 newStats[Stat.NDV.ordinal()] =
getCombinedSetEstimate(setOp, stats[Stat.NDV.ordinal()], statsOth
er[Stat.NDV.ordinal()], true);
{code}
Attached debugger to confirm it:-
{code}
# /usr/lib/jvm/java-1.6.0/bin/jdb -attach localhost:8787
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
catch java.lang.NullPointerException
Set all java.lang.NullPointerException
Exception occurred: java.lang.NullPointerException (to be caught at:
org.teiid.dqp.internal.process.Request.generatePlan(), line=435
bci=434)"thread=Worker4_QueryProcessorQueue8",
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.setColStatEstimates(),
line=427 bci=264
Worker4_QueryProcessorQueue8[1] locals
Method arguments:
node = instance of org.teiid.query.optimizer.relational.plantree.PlanNode(id=11316)
cardinality = 6.0
metadata = instance of org.teiid.query.metadata.TempMetadataAdapter(id=11317)
Local variables:
colStats = instance of
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil$ColStats(id=11318)
colStatsOther = instance of
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil$ColStats(id=11319)
childCardinality = 5.0
otherChildCardinality = 1.0
outputColsOther = instance of java.util.ArrayList(id=11320)
setOp = instance of org.teiid.query.sql.lang.SetQuery$Operation(id=11280)
outputCols = instance of java.util.ArrayList(id=11321)
newColStats = instance of
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil$ColStats(id=11322)
i = 0
expr = instance of org.teiid.query.sql.symbol.ElementSymbol(id=11323)
newStats = instance of float[2] (id=11324)
stats = null <===!!!!!!
statsOther = instance of float[2] (id=11325)
Worker4_QueryProcessorQueue8[1]
Worker4_QueryProcessorQueue8[1]
Worker4_QueryProcessorQueue8[1]
Worker4_QueryProcessorQueue8[1] print expr
expr = "V.TYPES.code"
Worker4_QueryProcessorQueue8[1] print colStats
colStats = "{'OL' AS code=[3.0, 0.0], 'manual' AS category=[3.0,
0.0]}"
Worker4_QueryProcessorQueue8[1]
Worker4_QueryProcessorQueue8[1]
{code}
Select literal query causes NPE
-------------------------------
Key: TEIID-2134
URL:
https://issues.jboss.org/browse/TEIID-2134
Project: Teiid
Issue Type: Bug
Components: Query Engine
Affects Versions: 7.4.1, 7.7
Environment: EDS 5.2.0 GA
Reporter: Hisanobu Okuda
Assignee: Steven Hawkins
Attachments: DF.vdb
I deployed the attached vdb and run the following query:-
{code}
SELECT
base.category
FROM
DF.V.BASE AS base
left outer JOIN
(
SELECT
code,
category
FROM
DF.V.TYPES) AS types
ON
types.code = base.code;
{code}
Then, it caused NPE:-
{code}
07:49:31,084 ERROR [PROCESSOR] Unexpected exception for request 7mHtpqQ7yb3J.0
java.lang.NullPointerException
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.setColStatEstimates(NewCalculateCostUtil.java:427)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.setCardinalityEstimate(NewCalculateCostUtil.java:328)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.estimateSetOpCost(NewCalculateCostUtil.java:274)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.computeNodeCost(NewCalculateCostUtil.java:226)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:158)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:155)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:155)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:155)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:155)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.updateCardinality(NewCalculateCostUtil.java:155)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.computeCostForTree(NewCalculateCostUtil.java:144)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.computeCostForDepJoin(NewCalculateCostUtil.java:1142)
at
org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil.computeCostForDepJoin(NewCalculateCostUtil.java:1131)
at
org.teiid.query.optimizer.relational.rules.RuleChooseDependent.execute(RuleChooseDependent.java:93)
at
org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:463)
at
org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:227)
at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:192)
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:433)
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:456)
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:482)
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:271)
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49)
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:210)
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:238)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:122)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira