[
https://issues.apache.org/jira/browse/CALCITE-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14332430#comment-14332430
]
Vladimir Sitnikov commented on CALCITE-601:
-------------------------------------------
I am not. Seriously.
As I read the code, BINDABLE pretends to _support_ being a top output (as
in "output for CalcitePrepare") convention.
For instance, Table interface does not pretend it outputs Enumerable or
whatever. That is a bit fuzzing, but it forces you to look for
implementations.
On contrary, Bindable interface outputs something while keeping the
metadata in secret. That bind method alone has no purpose. You can't use it.
I do not question the purpose of BINDABLE here (discussion of it here is
off-topic).
My concern is "if a convention can appear in CalcitePrepare, then it should
have at least minimum metadata for consumer (CalcitePrepare)". I do not
accept "we create CalcitePrepare and only we create all implementations of
Bindable" since it makes things hard to support: you have to remember those
secret calling convention and your IDE does not help you
> Meta.CursorFactory#deduce should not try to check column count
> --------------------------------------------------------------
>
> Key: CALCITE-601
> URL: https://issues.apache.org/jira/browse/CALCITE-601
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.0.0-incubating
> Reporter: Vladimir Sitnikov
> Assignee: Julian Hyde
>
> Current implementation of {{Meta.CursorFactory#deduce}} thinks that
> Enumerable with single column cannot be {{Object\[\]}} wrapped.
> This sounds like an extreme high coupling.
> I think it makes sense if "Bindable" would provide its {{JavaRowFormat}}
> along with "ElementType".
> I think it makes sense to reject non-typed, non-rowformatproviding Bindables
> out of Enumerable/Bindable conventions.
> {code:java}
> public static CursorFactory deduce(List<ColumnMetaData> columns,
> Class resultClazz) {
> if (columns.size() == 1) {
> return OBJECT; // <-- !! Look here. deduce just assumes
> single-column results are always naked
> } else if (resultClazz != null && !resultClazz.isArray()) {
> return record(resultClazz);
> } else {
> return ARRAY;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)