[ 
https://issues.apache.org/jira/browse/CALCITE-4417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17237720#comment-17237720
 ] 

Alexander Staubo commented on CALCITE-4417:
-------------------------------------------

Ah, I didn't know that Calcite treats these results as objects. I'd have 
expected it to derive the schema from the mappings so as to assign the right 
types.

Using casts eliminates the error, but does not return any rows, despite 
scrolling through the entire index. I assume it's related to the join predicate 
somehow failing.

Here's a sample of the test_department table:
{code:java}
> select d._MAP['id'] as id from "test_department" d where d._MAP['id'] = 
> '0000000008' limit 10;
+------------+
|     ID     |
+------------+
| 0000000008 |
+------------+
1 row selected (0.02 seconds)
{code}
Here's a sample of test_person:

 
{code:java}
> select cast(p._MAP['id'] as varchar) as id, cast(p._MAP['department._ref'] as 
> varchar) as dept from "test_person" p where p._MAP['department._ref'] = 
> '0000000008' limit 10;
+------------+------------+
|     ID     |    DEPT    |
+------------+------------+
| 000000VEGJ | 0000000008 |
| 00000000VB | 0000000008 |
| 000000TRST | 0000000008 |
| 00000KINRU | 0000000008 |
| 00000ANDEL | 0000000008 |
| 00000EMIDU | 0000000008 |
| 00000SOFBO | 0000000008 |
| 00000EIRHE | 0000000008 |
+------------+------------+
8 rows selected (0.025 seconds)
{code}
Here's the join:

 
{code:java}
> select p._MAP['id'] as id, d._MAP['id'] as dept from "test_person" p join 
> "test_department" d on cast(d._MAP['id'] as varchar) = 
> cast(p._MAP['department._ref'] as varchar) where p._MAP['department._ref'] = 
> '0000000008' limit 1;
+----+------+
| ID | DEPT |
+----+------+
+----+------+
No rows selected (0.092 seconds)
{code}

> "Two non-abstract methods ... have the same parameter types"
> ------------------------------------------------------------
>
>                 Key: CALCITE-4417
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4417
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.26.0
>         Environment: {code:java}
> $ java -version
> openjdk version "11.0.9" 2020-10-20
> OpenJDK Runtime Environment (build 11.0.9+11)
> OpenJDK 64-Bit Server VM (build 11.0.9+11, mixed mode)
> $ git rev-parse HEAD
> cfa37c3fd6ae18894035721d9f1eacde40e6b268
> {code}
>            Reporter: Alexander Staubo
>            Priority: Major
>         Attachments: error.out
>
>
> I'm trying out the Elasticsearch adapter. My query:
> {code:java}
> select p._MAP['id'] as id, d._MAP['id'] as dept
> from "test_person" p
> join "test_department" d on d._MAP['id'] = p._MAP['department._ref']
> where p._MAP['department._ref'] is not null
> limit 1;
> {code}
> This fails with:
> {code:java}
> Error while compiling generated Java code: [...]
> Caused by: org.codehaus.janino.InternalCompilerException: Compiling "Baz": 
> Two non-abstract methods "public int Baz$4.compare(java.lang.Object, 
> java.lang.Object)" have the same parameter types, declaring type and return 
> type
> {code}
> Full debug output: [^error.out]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to