vinothchandar commented on a change in pull request #4404:
URL: https://github.com/apache/hudi/pull/4404#discussion_r773568585



##########
File path: 
hudi-client/hudi-spark-client/src/main/scala/org/apache/spark/sql/hudi/CustomJavaRDD.scala
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.hudi
+
+import org.apache.spark.api.java.JavaSparkContext.fakeClassTag
+import org.apache.spark.api.java.{JavaRDD, function}
+import org.apache.spark.rdd.RDD
+import scala.reflect.ClassTag
+
+class CustomJavaRDD[T](override val rdd: RDD[T])(implicit override val 
classTag: ClassTag[T]) extends JavaRDD (rdd)(classTag) {

Review comment:
       javadocs/scaladocs?

##########
File path: 
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/execution/bulkinsert/RDDCustomColumnsSortPartitioner.java
##########
@@ -54,9 +55,9 @@ public RDDCustomColumnsSortPartitioner(String[] columnNames, 
Schema schema) {
                                                      int 
outputSparkPartitions) {
     final String[] sortColumns = this.sortColumnNames;
     final SerializableSchema schema = this.serializableSchema;
-    return records.sortBy(
+    return CustomJavaRDD.fromRDD(records,records.classTag()).sortBy(

Review comment:
       could you please help me understand this change? Looks like 
`HoodieAvroUtils.getRecordColumnValues(record, sortColumns, schema)` returns a 
string. Could we not sort by `Option<String>` or even a `"null"` string value 
if the column value is null?  We just want it to sort consistently and not 
break, that's all correct? Would n't that suffice without resorting to custom 
java rdds ?

##########
File path: 
hudi-client/hudi-spark-client/src/main/scala/org/apache/spark/sql/hudi/HoodieComparator.scala
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.hudi
+
+class HoodieComparator[S] extends Ordering[S] {
+  import com.google.common.collect.Ordering

Review comment:
       we cannot use guava inside Hudi. Its an illegal import in java code. 
Love to again understand why this is needed.




-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to