[jira] [Commented] (CALCITE-2468) Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

2018-12-03 Thread Rong Rong (JIRA)


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

Rong Rong commented on CALCITE-2468:


Hi [~julianhyde], sorry I somehow missed the 2nd part of your last comment. You 
are right, recursive is obviously more elegant! I just changed the code and 
remove the TODO ( no longer needed ). please kindly take another look.

> Validator throws IndexOutOfBoundsException when trying to infer operand type 
> from struct return type
> 
>
> Key: CALCITE-2468
> URL: https://issues.apache.org/jira/browse/CALCITE-2468
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.17.0
>Reporter: Rong Rong
>Assignee: Julian Hyde
>Priority: Major
>
> IOOBE was thrown when trying to acquire {{SqlOperandTypeInference}} using 
> {{RETURN_TYPE}} at:
> https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68
> The follow SQLs demonstrates how to trigger the exception over a simple 
> Schema:
> {code:yaml}
> - table1:
>   - structType1:
> - intField
>   - structType2:
> - intField
> - bigintField
> {code}
> - Exception SQL:
> {code:sql}
> SELECT structType1 AS myStructType FROM table1
> {code}
> - Correct SQL:
> {code:sql}
> SELECT structType1 FROM table1
> {code}
> {code:sql}
> SELECT structType2 AS myStructType FROM table1
> {code}
> E2E example can be found in:
> https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2468) Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

2018-12-03 Thread Julian Hyde (JIRA)


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

Julian Hyde commented on CALCITE-2468:
--

Did you try recursing? The code for AS still looks very brittle. Also, there is 
one more TODO than before, which I find worrying.

> Validator throws IndexOutOfBoundsException when trying to infer operand type 
> from struct return type
> 
>
> Key: CALCITE-2468
> URL: https://issues.apache.org/jira/browse/CALCITE-2468
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.17.0
>Reporter: Rong Rong
>Assignee: Julian Hyde
>Priority: Major
>
> IOOBE was thrown when trying to acquire {{SqlOperandTypeInference}} using 
> {{RETURN_TYPE}} at:
> https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68
> The follow SQLs demonstrates how to trigger the exception over a simple 
> Schema:
> {code:yaml}
> - table1:
>   - structType1:
> - intField
>   - structType2:
> - intField
> - bigintField
> {code}
> - Exception SQL:
> {code:sql}
> SELECT structType1 AS myStructType FROM table1
> {code}
> - Correct SQL:
> {code:sql}
> SELECT structType1 FROM table1
> {code}
> {code:sql}
> SELECT structType2 AS myStructType FROM table1
> {code}
> E2E example can be found in:
> https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2468) Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

2018-11-15 Thread Julian Hyde (JIRA)


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

Julian Hyde commented on CALCITE-2468:
--

Looks OK. Can you make into a pull request. In the test, please add a comment 
what issue it is a test case for. I also wonder whether you can simplify - if 
it is AS, don't check the operands, just recurse.

> Validator throws IndexOutOfBoundsException when trying to infer operand type 
> from struct return type
> 
>
> Key: CALCITE-2468
> URL: https://issues.apache.org/jira/browse/CALCITE-2468
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.17.0
>Reporter: Rong Rong
>Assignee: Julian Hyde
>Priority: Major
>
> IOOBE was thrown when trying to acquire {{SqlOperandTypeInference}} using 
> {{RETURN_TYPE}} at:
> https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68
> The follow SQLs demonstrates how to trigger the exception over a simple 
> Schema:
> {code:yaml}
> - table1:
>   - structType1:
> - intField
>   - structType2:
> - intField
> - bigintField
> {code}
> - Exception SQL:
> {code:sql}
> SELECT structType1 AS myStructType FROM table1
> {code}
> - Correct SQL:
> {code:sql}
> SELECT structType1 FROM table1
> {code}
> {code:sql}
> SELECT structType2 AS myStructType FROM table1
> {code}
> E2E example can be found in:
> https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2468) Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

2018-11-15 Thread Rong Rong (JIRA)


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

Rong Rong commented on CALCITE-2468:


Found out that the special handling for *{{AS}}* operator is to blame here, 
since *{{alias}}* should never be run against operand type inference procedure 
according to the {{SqlAsOperator.deriveType}} code. it causes issue curing 
SqlToRelConverter phase. 

I have a quick fix 
https://github.com/apache/calcite/compare/master...walterddr:CALCITE-2468. 
Please kindly take a look.

> Validator throws IndexOutOfBoundsException when trying to infer operand type 
> from struct return type
> 
>
> Key: CALCITE-2468
> URL: https://issues.apache.org/jira/browse/CALCITE-2468
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.17.0
>Reporter: Rong Rong
>Assignee: Julian Hyde
>Priority: Major
>
> IOOBE was thrown when trying to acquire {{SqlOperandTypeInference}} using 
> {{RETURN_TYPE}} at:
> https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68
> The follow SQLs demonstrates how to trigger the exception over a simple 
> Schema:
> {code:yaml}
> - table1:
>   - structType1:
> - intField
>   - structType2:
> - intField
> - bigintField
> {code}
> - Exception SQL:
> {code:sql}
> SELECT structType1 AS myStructType FROM table1
> {code}
> - Correct SQL:
> {code:sql}
> SELECT structType1 FROM table1
> {code}
> {code:sql}
> SELECT structType2 AS myStructType FROM table1
> {code}
> E2E example can be found in:
> https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2468) Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

2018-08-20 Thread Julian Hyde (JIRA)


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

Julian Hyde commented on CALCITE-2468:
--

I wonder whether RelStructuredTypeFlattener is to blame. Although the stack 
trace in the Flink case indicates that it's still in the validator and has 
probably not got to RelStructuredTypeFlattener yet.

> Validator throws IndexOutOfBoundsException when trying to infer operand type 
> from struct return type
> 
>
> Key: CALCITE-2468
> URL: https://issues.apache.org/jira/browse/CALCITE-2468
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.17.0
>Reporter: Rong Rong
>Assignee: Julian Hyde
>Priority: Major
>
> IOOBE was thrown when trying to acquire {{SqlOperandTypeInference}} using 
> {{RETURN_TYPE}} at:
> https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68
> The follow SQLs demonstrates how to trigger the exception over a simple 
> Schema:
> {code:yaml}
> - table1:
>   - structType1:
> - intField
>   - structType2:
> - intField
> - bigintField
> {code}
> - Exception SQL:
> {code:sql}
> SELECT structType1 AS myStructType FROM table1
> {code}
> - Correct SQL:
> {code:sql}
> SELECT structType1 FROM table1
> {code}
> {code:sql}
> SELECT structType2 AS myStructType FROM table1
> {code}
> E2E example can be found in:
> https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)