vvysotskyi commented on a change in pull request #1843: DRILL-7350: Move RowSet
related classes from test folder
URL: https://github.com/apache/drill/pull/1843#discussion_r314448553
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/rowSet/RowSetWriterImpl.java
##########
@@ -129,7 +129,7 @@ public RowSetWriter addRow(Object...values) {
@Override
public RowSetWriter addSingleCol(Object value) {
- return addRow(new Object[] {value});
+ return addRow(value);
Review comment:
I made this change because IDE proposed it but after some investigation, I
still think that it will work as it is expected. Java determines whether to
treat the incoming argument as a single element or as an array for vararg
functions at the compilation stage. So for the following case code will work as
you have described - the vararg will be a one-dimensional array of strings:
```
addRow(new String[]{"a", "b"});
```
But the following case will have different behavior - vararg will be treated
as a two-dimensional array:
```
Object s = new String[]{"a", "a"};
addRow(s);
```
So code here will work as it is expected.
----------------------------------------------------------------
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