the-other-tim-brown commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1201011129
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/AvroConversionUtils.scala:
##########
@@ -138,18 +139,26 @@ object AvroConversionUtils {
def convertStructTypeToAvroSchema(structType: DataType,
structName: String,
recordNamespace: String): Schema = {
- val schemaConverters = sparkAdapter.getAvroSchemaConverters
- val avroSchema = schemaConverters.toAvroType(structType, nullable = false,
structName, recordNamespace)
- getAvroSchemaWithDefaults(avroSchema, structType)
+ try {
+ val schemaConverters = sparkAdapter.getAvroSchemaConverters
+ val avroSchema = schemaConverters.toAvroType(structType, nullable =
false, structName, recordNamespace)
Review Comment:
Should the `schemaConverters.toAvroType` throw the HoodieSchemaException
instead of this util class?
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/RowBasedSchemaProvider.java:
##########
@@ -44,7 +45,12 @@ public RowBasedSchemaProvider(StructType rowStruct) {
@Override
public Schema getSourceSchema() {
- return AvroConversionUtils.convertStructTypeToAvroSchema(rowStruct,
HOODIE_RECORD_STRUCT_NAME,
- HOODIE_RECORD_NAMESPACE);
+ try {
+ return AvroConversionUtils.convertStructTypeToAvroSchema(rowStruct,
HOODIE_RECORD_STRUCT_NAME,
+ HOODIE_RECORD_NAMESPACE);
+ } catch (Exception e) {
+ throw new HoodieSchemaException("Failed to convert struct type to avro
schema", e);
Review Comment:
Should we move this throw into the AvroConversionUtils? I see other methods
in there throw the exception themselves.
##########
hudi-common/src/main/java/org/apache/hudi/exception/HoodieMetaSyncException.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.hudi.exception;
+
+public class HoodieMetaSyncException extends HoodieException {
Review Comment:
Can we include the list of syncs involved so we can easily handle different
sync failures with custom logic?
--
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]