codope commented on code in PR #12455:
URL: https://github.com/apache/hudi/pull/12455#discussion_r1881328995


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/HoodieSparkExpressionIndex.java:
##########
@@ -81,40 +84,57 @@ interface SparkFunction extends Serializable {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("FROM_UNIXTIME requires 1 
column");
         }
-        return functions.from_unixtime(columns.get(0), options.get("format"));
+        if (options.containsKey(FORMAT_OPTION)) {
+          return functions.from_unixtime(columns.get(0), 
options.get(FORMAT_OPTION));
+        } else {
+          return functions.from_unixtime(columns.get(0));
+        }
       }),
       Pair.of(SPARK_UNIX_TIMESTAMP, (columns, options) -> {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("UNIX_TIMESTAMP requires 1 
column");
         }
-        return functions.unix_timestamp(columns.get(0), options.get("format"));
+        if (options.containsKey(FORMAT_OPTION)) {
+          return functions.unix_timestamp(columns.get(0), 
options.get(FORMAT_OPTION));
+        } else {
+          return functions.unix_timestamp(columns.get(0));
+        }
       }),
       Pair.of(SPARK_TO_DATE, (columns, options) -> {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("TO_DATE requires 1 column");
         }
-        return functions.to_date(columns.get(0));
+        if (options.containsKey(FORMAT_OPTION)) {
+          return functions.to_date(columns.get(0), options.get(FORMAT_OPTION));
+        } else {
+          return functions.to_date(columns.get(0));
+        }
       }),
       Pair.of(SPARK_TO_TIMESTAMP, (columns, options) -> {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("TO_TIMESTAMP requires 1 column");
         }
-        return functions.to_timestamp(columns.get(0));
+        if (options.containsKey(FORMAT_OPTION)) {
+          return functions.to_timestamp(columns.get(0), 
options.get(FORMAT_OPTION));
+        } else {
+          return functions.to_timestamp(columns.get(0));
+        }
       }),
       Pair.of(SPARK_DATE_ADD, (columns, options) -> {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("DATE_ADD requires 1 column");
         }
-        return functions.date_add(columns.get(0), 
Integer.parseInt(options.get("days")));
+        return functions.date_add(columns.get(0), 
Integer.parseInt(options.get(DAYS_OPTION)));
       }),
       Pair.of(SPARK_DATE_SUB, (columns, options) -> {
         if (columns.size() != 1) {
           throw new IllegalArgumentException("DATE_SUB requires 1 column");
         }
-        return functions.date_sub(columns.get(0), 
Integer.parseInt(options.get("days")));
+        return functions.date_sub(columns.get(0), 
Integer.parseInt(options.get(DAYS_OPTION)));
       }),
 
       // String functions
+      // TODO: Concat is not yet supported fully since there is a limitation 
of only one source field within expression index

Review Comment:
   Shall we remove this? I mean the function (concat might not be very useful 
anyway)



-- 
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]

Reply via email to