Dmitry Sysolyatin created CALCITE-6494:
------------------------------------------
Summary: MongoAdapter throws an exception if any function
unsupported by MongoProject is used
Key: CALCITE-6494
URL: https://issues.apache.org/jira/browse/CALCITE-6494
Project: Calcite
Issue Type: Bug
Components: mongodb-adapter
Affects Versions: 1.37.0
Reporter: Dmitry Sysolyatin
MongoAdapter throws an exception if any function unsupported by MongoProject is
used
A simple example [1]:
{code}
@Test void testCalciteFunc() {
assertModel(MODEL)
.query("select CHAR_LENGTH(state) from zips")
.runs();
}
{code}
throws
{code}
Suppressed: java.lang.IllegalArgumentException: Translation of
CHAR_LENGTH(CAST(ITEM($0, 'state')):VARCHAR(2)) is not supported by MongoProject
{code}
The reason is that MongoProjectRule does not properly filter projects from
LogicalProjects.getNamedProjects that can be used. I think the proper
implementation of this rule should be similar to DruidProjectRule. It should
extract input references from the project if it cannot be fully supported and
add an additional Project on top of MongoProject.
[1] -
https://github.com/dssysolyatin/calcite/commit/96cddae9c6516701e1aa44f7c75df5afdc497f8d
--
This message was sent by Atlassian Jira
(v8.20.10#820010)