dengzhhu653 commented on code in PR #6549:
URL: https://github.com/apache/hive/pull/6549#discussion_r3540919212
##########
serde/src/java/org/apache/hadoop/hive/serde2/avro/AvroSerdeUtils.java:
##########
@@ -137,12 +141,28 @@ public static Schema
determineSchemaOrThrowException(Configuration conf, Propert
throw new AvroSerdeException(EXCEPTION_MESSAGE);
}
+ validateSchemaUrl(schemaString, conf);
+
try {
- Schema s = getSchemaFromFS(schemaString, conf);
- if (s == null) {
- //in case schema is not a file system
- return AvroSerdeUtils.getSchemaFor(new URL(schemaString));
+ Schema s;
+ if (requiresHttpFetch(schemaString)) {
+ URL url = new URL(schemaString);
+ java.net.URLConnection conn = url.openConnection();
+ if (conn instanceof java.net.HttpURLConnection) {
+ ((java.net.HttpURLConnection)
conn).setInstanceFollowRedirects(false);
+ }
+ try (InputStream in = conn.getInputStream()) {
+ s = getSchemaParser().parse(in);
+ }
+ } else {
+ s = getSchemaFromFS(schemaString, conf);
+ if (s == null) {
+ throw new AvroSerdeException("Unable to read Avro schema from: " +
schemaString
+ + ". avro.schema.url must refer to a Hadoop FileSystem URI (e.g.
hdfs://, s3a://). "
+ + "Consider using avro.schema.literal instead.");
+ }
}
+ materializeResolvedSchema(properties, conf, s);
Review Comment:
any reason why do we need to materialize the schema compared as before
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]