[
https://issues.jboss.org/browse/TEIID-4113?page=com.atlassian.jira.plugin...
]
Steven Hawkins commented on TEIID-4113:
---------------------------------------
Should be able to produce the issue with the //Teiid query block that
produces the output seen in the //Query sent to Impala block above.
Here's the abridged version of a BaseQueryTest that I'm running on master/8.13.3
with the simple query expression for the view definition, which confirms the appropriate
source query:
{code}
public void testQuery() throws Exception{
ImpalaExecutionFactory ief = new ImpalaExecutionFactory();
ief.setDatabaseVersion("2.0");
ief.start();
DefaultCapabilitiesFinder finder = new
DefaultCapabilitiesFinder(CapabilitiesConverter.convertCapabilities(ief));
HardcodedDataManager dataMgr = new HardcodedDataManager();
List<?>[] expected = new List<?>[] { };
dataMgr.addData("SELECT g_0.the_attribute, convert((SUM(g_0.first_metric) /
convert(COUNT(DISTINCT CASE WHEN g_0.second_metric >= 0 THEN g_0.second_metric END),
long)), double), g_0.another_attribute FROM y.SourceTable AS g_0 WHERE g_0.a_filter_val =
111 GROUP BY g_0.the_attribute, g_0.another_attribute", //$NON-NLS-1$
expected);
doProcess(RealMetadataFactory.fromDDL("create foreign table SourceTable
(the_attribute string(255), first_metric long, second_metric bigdecimal, another_attribute
String(255), a_filter_val integer); "
+ " create view VirtualTable (the_attribute string(255), first_metric long,
second_metric bigdecimal, another_attribute String(255), a_filter_val integer) as (select
* from SourceTable)", "x", "y"),
"SELECT the_attribute, cast( sum( first_metric ) / count( distinct
case when second_metric >= 0 then second_metric end ) as double ) as some_alias,
PARSETIMESTAMP(another_attribute, 'yyyy-MM-dd') as somedate FROM VirtualTable
WHERE a_filter_val=111 GROUP BY the_attribute, another_attribute", //$NON-NLS-1$
finder, dataMgr, expected, DEBUG);
}
}
{code}
So there must be a few more needed details.
Impala translator - Incorrect aggregate replacement in query
------------------------------------------------------------
Key: TEIID-4113
URL:
https://issues.jboss.org/browse/TEIID-4113
Project: Teiid
Issue Type: Bug
Components: JDBC Connector
Affects Versions: 8.13.3
Environment: Ubuntu Trusty
Reporter: Don Krapohl
Assignee: Steven Hawkins
Labels: Impala_Translator
When PARSETIMESTAMP is included in a query aggregates in other columns may not be written
correctly. Example is as below, sum(first_metric) is rewritten to anon_grp0.agg0 in the
query sent to Impala.
Given the schema:
//source
SourceTable
the_attribute string(255),
first_metric long,
second_metric bigdecimal
another_attribute String(255)
//view
VirtualTable
the_attribute string(255),
first_metric long,
second_metric bigdecimal
another_attribute String(255)
// Teiid query
SELECT the_attribute,
cast(
sum(
first_metric
)
/
count(
distinct case when second_metric >= 0 then second_metric end
) as double
) as some_alias,
PARSETIMESTAMP(another_attribute, 'yyyy-MM-dd') as somedate
FROM VirtualTable
WHERE a_filter_val=111
GROUP BY the_attribute, another_attribute
//Query sent to impala
SELECT g_0.the_attribute AS c_0,
cast(
(
anon_grp0.agg0
/
cast(
anon_grp0.agg1 AS bigint
)
) AS double
) AS c_1,
g_0.another_attribute AS c_2
FROM VirtualTable
WHERE a_filter_val=111
GROUP BY g_0.the_attribute, g_0.another_attribute
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)