diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java b/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java index 68138c8..b2bbab9 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java @@ -29,6 +29,7 @@ import org.apache.avro.generic.GenericDatumReader; import org.apache.avro.generic.GenericRecord; import org.apache.avro.mapred.FsInput; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.fs.Path; @@ -113,10 +114,8 @@ private Schema getSchema(JobConf job, FileSplit split) throws AvroSerdeException for (Map.Entry pathsAndParts: mapWork.getPathToPartitionInfo().entrySet()){ Path partitionPath = pathsAndParts.getKey(); if(pathIsInPartition(split.getPath(), partitionPath)) { - if(LOG.isInfoEnabled()) { - LOG.info("Matching partition " + partitionPath + - " with input split " + split); - } + LOG.info("Matching partition {} with input split {}", partitionPath, + split); Properties props = pathsAndParts.getValue().getProperties(); if(props.containsKey(AvroTableProperties.SCHEMA_LITERAL.getPropName()) || props.containsKey(AvroTableProperties.SCHEMA_URL.getPropName())) { @@ -127,17 +126,16 @@ private Schema getSchema(JobConf job, FileSplit split) throws AvroSerdeException } } } - if(LOG.isInfoEnabled()) { - LOG.info("Unable to match filesplit " + split + " with a partition."); - } + LOG.info("Unable to match filesplit {} with a partition.", split); } // In "select * from table" situations (non-MR), we can add things to the job // It's safe to add this to the job since it's not *actually* a mapred job. // Here the global state is confined to just this process. String s = job.get(AvroTableProperties.AVRO_SERDE_SCHEMA.getPropName()); - if(s != null) { - LOG.info("Found the avro schema in the job: " + s); + if (StringUtils.isNotBlank(s)) { + LOG.info("Found the avro schema in the job"); + LOG.debug("Avro schema: {}", s); return AvroSerdeUtils.getSchemaFor(s); } // No more places to get the schema from. Give up. May have to re-encode later.