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


##########
hudi-common/src/main/java/org/apache/hudi/index/functional/HoodieExpressionIndex.java:
##########
@@ -59,7 +59,14 @@ public interface HoodieExpressionIndex<S, T> extends 
Serializable {
   String IDENTITY_FUNCTION = "identity";
 
   String EXPRESSION_OPTION = "expr";
-
+  String FORMAT_OPTION = "format";
+  String DAYS_OPTION = "days";
+  String POSITION_OPTION = "pos";
+  String LENGTH_OPTION = "len";
+  String PATTERN_OPTION = "pattern";
+  String REPLACEMENT_OPTION = "replacement";
+  String REGEX_GROUP_INDEX_OPTION = "idx";
+  String TRIM_STRING_OPTION = "trimString";

Review Comment:
   I have refactored this part. Moved these functions to separate interfaces.



##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/RecordLevelIndexSupport.scala:
##########
@@ -351,6 +351,14 @@ object RecordLevelIndexSupport {
       case literal: Literal => expression2 match {
         case attr: AttributeReference =>
           Option.apply(attr, literal)
+        case cast: Cast if cast.child.isInstanceOf[AttributeReference] =>
+          Option.apply(cast.child.asInstanceOf[AttributeReference], literal)

Review Comment:
   Yes, it should be a resolved reference.



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/command/index/TestExpressionIndex.scala:
##########
@@ -846,11 +852,122 @@ class TestExpressionIndex extends HoodieSparkSqlTestBase 
{
           var literal = Literal.create("rider-c")
           var dataFilter = EqualTo(lowerExpr, literal)
           verifyFilePruning(opts, dataFilter, metaClient, 
isDataSkippingExpected = true)
+          spark.sql(s"drop index idx_rider on $tableName")
 
           val fromUnixTime = resolveExpr(spark, 
unapply(functions.from_unixtime(functions.col("ts"), "yyyy-MM-dd")).get, 
tableSchema)
           literal = Literal.create("2023-11-07")
           dataFilter = EqualTo(fromUnixTime, literal)
           verifyFilePruning(opts, dataFilter, metaClient, 
isDataSkippingExpected = true)
+          spark.sql(s"drop index idx_datestr on $tableName")

Review Comment:
   I have separated the test for date and string functions.



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