JingsongLi commented on a change in pull request #8035: 
[FLINK-11975][table-planner-blink] Support to run a sql query : 'SELECT * FROM 
(VALUES (1, 2, 3)) T(a, b, c)'
URL: https://github.com/apache/flink/pull/8035#discussion_r268471870
 
 

 ##########
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/generated/GeneratedClass.java
 ##########
 @@ -49,10 +49,13 @@ protected GeneratedClass(String className, String code, 
Object[] references) {
        @SuppressWarnings("unchecked")
        public T newInstance(ClassLoader classLoader) {
                try {
-                       return (T) 
compile(classLoader).getConstructor(Object[].class)
-                                       // Because 
Constructor.newInstance(Object... initargs), we need to load
-                                       // references into a new Object[], 
otherwise it cannot be compiled.
-                                       .newInstance(new Object[] {references});
+                       if (references.length > 0) {
 
 Review comment:
   It not work if the class don't have non-args constructor and 
`references.length` is 0.
   I think all generated class should invoke `newInstance(new Object[] 
{references})`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to