afedulov commented on code in PR #19286:
URL: https://github.com/apache/flink/pull/19286#discussion_r889011653
##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowDataDeserializationSchema.java:
##########
@@ -206,6 +235,6 @@ public int hashCode() {
csvSchema.getArrayElementSeparator(),
csvSchema.getQuoteChar(),
csvSchema.getEscapeChar(),
- csvSchema.getNullValue());
+ Arrays.hashCode(csvSchema.getNullValue()));
Review Comment:
Because otherwise, we check for the pointer's equality, not equality of the
array's content (what we actually want). For a quick test:
```
public static void main(String[] args) {
char[] arr1 = { 'x', 'y', 'z' };
char[] arr2 = { 'x', 'y', 'z' };
System.out.println("arr1.hashCode(): " + arr1.hashCode() + ";
arr2.hashCode(): " + arr2.hashCode());
System.out.println("Arrays.hashCode(arr1):" + Arrays.hashCode(arr1)
+ "; Arrays.hashCode(arr1): " + Arrays.hashCode(arr2));
}
```
##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowDataDeserializationSchema.java:
##########
@@ -206,6 +235,6 @@ public int hashCode() {
csvSchema.getArrayElementSeparator(),
csvSchema.getQuoteChar(),
csvSchema.getEscapeChar(),
- csvSchema.getNullValue());
+ Arrays.hashCode(csvSchema.getNullValue()));
Review Comment:
Because otherwise, we check for the pointers equality, not equality of the
array's content (what we actually want). For a quick test:
```
public static void main(String[] args) {
char[] arr1 = { 'x', 'y', 'z' };
char[] arr2 = { 'x', 'y', 'z' };
System.out.println("arr1.hashCode(): " + arr1.hashCode() + ";
arr2.hashCode(): " + arr2.hashCode());
System.out.println("Arrays.hashCode(arr1):" + Arrays.hashCode(arr1)
+ "; Arrays.hashCode(arr1): " + Arrays.hashCode(arr2));
}
```
--
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]