zstan commented on code in PR #13543:
URL: https://github.com/apache/ignite/pull/13543#discussion_r3933960388


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/TableFunctionScan.java:
##########
@@ -58,14 +65,19 @@ private Row convertToRow(Object rowContainer) {
             throw new IgniteSQLException("Unable to process table function 
data: row type is neither Collection or Object[].");
 
         Object[] rowArr = rowContainer.getClass() == Object[].class
-            ? (Object[])rowContainer
+            ? ((Object[])rowContainer).clone()
             : ((Collection<?>)rowContainer).toArray();
 
         if (rowArr.length != rowType.getFieldCount()) {
             throw new IgniteSQLException("Unable to process table function 
data: row length [" + rowArr.length
                 + "] doesn't match defined columns number [" + 
rowType.getFieldCount() + "].");
         }
 
+        for (int i = 0; i < rowArr.length; i++) {
+            if (!(rowType.getFieldList().get(i).getType() instanceof 
OtherType))
+                rowArr[i] = TypeUtils.toInternal(ctx, rowArr[i]);

Review Comment:
   failed:
   ```
           assertQuery("SELECT EXTRACT(YEAR FROM D) FROM f()")
               .resultSize(1)
               .check();
   
           @QuerySqlTableFunction(columnTypes =
               {java.util.Date.class}, columnNames = {"D"})
           public static Iterable<Object[]> f() { // kill
               return Collections.singletonList(new Object[] 
{java.sql.Date.valueOf("2020-01-01")});
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to