the-other-tim-brown commented on code in PR #17911:
URL: https://github.com/apache/hudi/pull/17911#discussion_r2698698422
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -166,7 +151,8 @@ public static boolean
validateDataTypeForSecondaryOrExpressionIndex(List<String>
* Check if the given schema type is supported for secondary index.
* Supported types are: String (including CHAR), Integer types (Int, BigInt,
Long, Short), and timestamp
*/
- private static boolean isSecondaryIndexSupportedType(HoodieSchema schema) {
+ @VisibleForTesting
+ public static boolean isSecondaryIndexSupportedType(HoodieSchema schema) {
Review Comment:
Make this package private since it is only visible for testing
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -719,28 +714,19 @@ static void
validateEligibilityForSecondaryOrExpressionIndex(HoodieTableMetaClie
String columnName = sourceFields.get(0); // We know there's only one
column from the check above
// First check if the field exists
- Pair<String, HoodieSchemaField> fieldSchema =
HoodieSchemaUtils.getNestedField(tableSchema, columnName)
+ Pair<String, HoodieSchemaField> fieldSchemaPair =
HoodieSchemaUtils.getNestedField(tableSchema, columnName)
.orElseThrow(() -> new HoodieMetadataIndexException(String.format(
- "Cannot create %s index '%s': Column '%s' does not exist in the
table schema. "
- + "Please verify the column name and ensure it exists in the
table.",
- indexType.equals(PARTITION_NAME_SECONDARY_INDEX) ? "secondary" :
"expression",
+ "Cannot create %s index '%s': Column '%s' does not exist in the
table schema. "
+ + "Please verify the column name and ensure it exists in the
table.",
+ indexType.equals(PARTITION_NAME_SECONDARY_INDEX) ? "secondary" :
"expression",
userIndexName, columnName)));
- // Check for complex types (RECORD, ARRAY, MAP) - not supported for any
index type
- if (!validateDataTypeForSecondaryOrExpressionIndex(sourceFields,
tableSchema)) {
Review Comment:
`validateDataTypeForSecondaryOrExpressionIndex` can be removed now?
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -192,6 +178,15 @@ private static boolean
isSecondaryIndexSupportedType(HoodieSchema schema) {
}
}
+ /**
+ * Check if the given schema type is a complex type (Record, Array, Map).
+ */
+ private static boolean isComplexType(HoodieSchema schema) {
Review Comment:
There is a method on the HoodieSchemaType for `isComplex`, let's use that
instead of duplicating the logic?
The call would look like `schema.getNonNullType().getType().isComplex()`
--
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]