[
https://issues.apache.org/jira/browse/CALCITE-529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14246576#comment-14246576
]
Vladimir Sitnikov commented on CALCITE-529:
-------------------------------------------
Here's the offending code:
https://github.com/apache/incubator-calcite/blob/94752a6066cd8a379782510a78a885cffb5aadb9/core/src/main/java/org/apache/calcite/rex/RexBuilder.java#L1229-1230
{code:java}
public RexNode makeLiteral(Object value, RelDataType type,
boolean allowCast) {
switch (type.getSqlTypeName()) {
...
case ANY:
return makeLiteral(value, guessType(value), allowCast);
{code}
I guess it breaks semantics: you tell it to create a literal of
{{Types.JAVA_OBJECT}} (this is how {{ANY}} is defined) and it tries to guess
the data type for you.
If only it could live with "here is my java object an I want to pass it to the
DB as is".
> Allow to pass java object via rexBuilder.makeLiteral()
> ------------------------------------------------------
>
> Key: CALCITE-529
> URL: https://issues.apache.org/jira/browse/CALCITE-529
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.0.0-incubating
> Reporter: Vladimir Sitnikov
> Assignee: Julian Hyde
> Labels: newbie
>
> Motivation: Rex is simpler that linq4j.
> For instance,
> 1) Sometimes it is easier to create a {{ProjectRel}} rather than lower the
> expression to low-level linq4j
> 2) XXXToEnumerableRule are easier to accomplish via TableFunctionScan. This
> allows to express the call via Rex and skip linq4j completely.
> For example:
> https://github.com/vlsi/mat-calcite-plugin/blob/master/MatCalcitePlugin/src/com/github/vlsi/mat/optiq/rules/InstanceAccessByClassIdRule.java#L43
> The problem is to pass non-literal java object to enumerable/interpreter
> conventions.
> For enumerable the implementation can use stash. For interpreter it can use
> the value as is, etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)