You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-40742][CORE][SQL] Fix Java compilation warnings related to generic type
### What changes were proposed in this pull request?
This pr aims to fix following Java compilation warnings related to generic type:
```
2022-10-08T01:43:33.6487078Z /home/runner/work/spark/spark/core/src/main/java/org/apache/spark/SparkThrowable.java:54: warning: [rawtypes] found raw type: HashMap
2022-10-08T01:43:33.6487456Z return new HashMap();
2022-10-08T01:43:33.6487682Z ^
2022-10-08T01:43:33.6487957Z missing type arguments for generic class HashMap<K,V>
2022-10-08T01:43:33.6488617Z where K,V are type-variables:
2022-10-08T01:43:33.6488911Z K extends Object declared in class HashMap
2022-10-08T01:43:33.6489211Z V extends Object declared in class HashMap
2022-10-08T01:50:21.5951932Z /home/runner/work/spark/spark/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagement.java:55: warning: [rawtypes] found raw type: Map
2022-10-08T01:50:21.5999993Z createPartitions(new InternalRow[]{ident}, new Map[]{properties});
2022-10-08T01:50:21.6000343Z ^
2022-10-08T01:50:21.6000642Z missing type arguments for generic class Map<K,V>
2022-10-08T01:50:21.6001272Z where K,V are type-variables:
2022-10-08T01:50:21.6001569Z K extends Object declared in interface Map
2022-10-08T01:50:21.6002109Z V extends Object declared in interface Map
2022-10-08T01:50:21.6006655Z /home/runner/work/spark/spark/sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:216: warning: [rawtypes] found raw type: Literal
2022-10-08T01:50:21.6007121Z protected String visitLiteral(Literal literal) {
2022-10-08T01:50:21.6007395Z ^
2022-10-08T01:50:21.6007673Z missing type arguments for generic class Literal<T>
2022-10-08T01:50:21.6008032Z where T is a type-variable:
2022-10-08T01:50:21.6008324Z T extends Object declared in interface Literal
2022-10-08T01:50:21.6008785Z /home/runner/work/spark/spark/sql/catalyst/src/main/java/org/apache/spark/sql/util/NumericHistogram.java:56: warning: [rawtypes] found raw type: Comparable
2022-10-08T01:50:21.6009223Z public static class Coord implements Comparable {
2022-10-08T01:50:21.6009503Z ^
2022-10-08T01:50:21.6009791Z missing type arguments for generic class Comparable<T>
2022-10-08T01:50:21.6010137Z where T is a type-variable:
2022-10-08T01:50:21.6010433Z T extends Object declared in interface Comparable
2022-10-08T01:50:21.6010976Z /home/runner/work/spark/spark/sql/catalyst/src/main/java/org/apache/spark/sql/util/NumericHistogram.java:191: warning: [unchecked] unchecked method invocation: method sort in class Collections is applied to given types
2022-10-08T01:50:21.6011474Z Collections.sort(tmp_bins);
2022-10-08T01:50:21.6011714Z ^
2022-10-08T01:50:21.6012050Z required: List<T>
2022-10-08T01:50:21.6012296Z found: ArrayList<Coord>
2022-10-08T01:50:21.6012604Z where T is a type-variable:
2022-10-08T01:50:21.6012926Z T extends Comparable<? super T> declared in method <T>sort(List<T>)
2022-10-08T02:13:38.0769617Z /home/runner/work/spark/spark/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/OperationManager.java:85: warning: [rawtypes] found raw type: AbstractWriterAppender
2022-10-08T02:13:38.0770287Z AbstractWriterAppender ap = new LogDivertAppender(this, OperationLog.getLoggingLevel(loggingMode));
2022-10-08T02:13:38.0770645Z ^
2022-10-08T02:13:38.0770947Z missing type arguments for generic class AbstractWriterAppender<M>
2022-10-08T02:13:38.0771330Z where M is a type-variable:
2022-10-08T02:13:38.0771665Z M extends WriterManager declared in class AbstractWriterAppender
2022-10-08T02:13:38.0774487Z /home/runner/work/spark/spark/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/LogDivertAppender.java:268: warning: [rawtypes] found raw type: Layout
2022-10-08T02:13:38.0774940Z Layout l = ap.getLayout();
2022-10-08T02:13:38.0775173Z ^
2022-10-08T02:13:38.0775441Z missing type arguments for generic class Layout<T>
2022-10-08T02:13:38.0775849Z where T is a type-variable:
2022-10-08T02:13:38.0776359Z T extends Serializable declared in interface Layout
2022-10-08T02:19:55.0035795Z [WARNING] /home/runner/work/spark/spark/connector/avro/src/main/java/org/apache/spark/sql/avro/SparkAvroKeyOutputFormat.java:56:17: [rawtypes] found raw type: SparkAvroKeyRecordWriter
2022-10-08T02:19:55.0037287Z [WARNING] /home/runner/work/spark/spark/connector/avro/src/main/java/org/apache/spark/sql/avro/SparkAvroKeyOutputFormat.java:56:13: [unchecked] unchecked call to SparkAvroKeyRecordWriter(Schema,GenericData,CodecFactory,OutputStream,int,Map<String,String>) as a member of the raw type SparkAvroKeyRecordWriter
2022-10-08T02:19:55.0038442Z [WARNING] /home/runner/work/spark/spark/connector/avro/src/main/java/org/apache/spark/sql/avro/SparkAvroKeyOutputFormat.java:75:31: [rawtypes] found raw type: DataFileWriter
2022-10-08T02:19:55.0039370Z [WARNING] /home/runner/work/spark/spark/connector/avro/src/main/java/org/apache/spark/sql/avro/SparkAvroKeyOutputFormat.java:75:27: [unchecked] unchecked call to DataFileWriter(DatumWriter<D>) as a member of the raw type DataFileWriter
```
### Why are the changes needed?
Fix Java compilation warnings.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass GitHub Actions.
Closesapache#38198 from LuciferYang/fix-java-warn.
Lead-authored-by: yangjie01 <[email protected]>
Co-authored-by: YangJie <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
0 commit comments