[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-24 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1204601709


##
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/SchemaRegistryProvider.java:
##
@@ -193,8 +201,8 @@ public Schema getTargetSchema() {
 String targetRegistryUrl = 
config.getString(HoodieSchemaProviderConfig.TARGET_SCHEMA_REGISTRY_URL.key(), 
registryUrl);
 try {
   return parseSchemaFromRegistry(targetRegistryUrl);
-} catch (IOException ioe) {
-  throw new HoodieIOException("Error reading target schema from registry 
:" + registryUrl, ioe);
+} catch (Exception e) {

Review Comment:
   yep



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



[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-23 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1202703409


##
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:
   So the message will contain all the other syncs.  For custom logic, I don't 
think it would be handled using the exception. 



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



[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-23 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1202703409


##
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:
   So the message will contain all the other syncs. They could be parsed out 
but I guess I could add them in a list at the beginning of the exception to 
make parsing easier.  For custom logic, I don't think it would be handled using 
the exception. 



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



[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-23 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1202697891


##
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:
   Good catch. I actually do throw it in there.



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



[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-23 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1202691156


##
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:
   I don't think we can. It looks like it's a spark internal class



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



[GitHub] [hudi] jonvex commented on a diff in pull request #8638: added new exception types

2023-05-15 Thread via GitHub


jonvex commented on code in PR #8638:
URL: https://github.com/apache/hudi/pull/8638#discussion_r1194295333


##
hudi-utilities/src/main/java/org/apache/hudi/utilities/exception/HoodieDeltaStreamerSchemaCompatibilityException.java:
##
@@ -0,0 +1,25 @@
+/*
+ * 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.utilities.exception;
+
+public class HoodieDeltaStreamerSchemaCompatibilityException extends 
HoodieDeltaStreamerException {

Review Comment:
   I think that depends on where it is thrown. I think there are 6 places it is 
thrown. Could you please point out which ones and what they should provide



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