Github user amansinha100 commented on a diff in the pull request:
https://github.com/apache/drill/pull/569#discussion_r75058437
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
---
@@ -470,41 +483,38 @@ private ParquetTableMetadataBase readBlockMeta(String
path) throws IOException {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
FSDataInputStream is = fs.open(p);
- ParquetTableMetadataBase parquetTableMetadata = mapper.readValue(is,
ParquetTableMetadataBase.class);
- logger.info("Took {} ms to read metadata from cache file",
timer.elapsed(TimeUnit.MILLISECONDS));
- timer.stop();
- if (tableModified(parquetTableMetadata, p)) {
- parquetTableMetadata =
-
(createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getLeft();
- }
- return parquetTableMetadata;
- }
-
- private ParquetTableMetadataDirs readMetadataDirs(String path) throws
IOException {
- Stopwatch timer = Stopwatch.createStarted();
- Path p = new Path(path);
- ObjectMapper mapper = new ObjectMapper();
-
- final SimpleModule serialModule = new SimpleModule();
- serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De());
-
- AfterburnerModule module = new AfterburnerModule();
- module.setUseOptimizedBeanDeserializer(true);
+ boolean alreadyCheckedModification = false;
+ boolean newMetadata = false;
- mapper.registerModule(serialModule);
- mapper.registerModule(module);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
- FSDataInputStream is = fs.open(p);
+ if (metaContext != null) {
+ alreadyCheckedModification =
metaContext.getStatus(parentDir.toString());
+ }
- ParquetTableMetadataDirs parquetTableMetadataDirs =
mapper.readValue(is, ParquetTableMetadataDirs.class);
- logger.info("Took {} ms to read directories from directory cache
file", timer.elapsed(TimeUnit.MILLISECONDS));
- timer.stop();
+ if (dirsOnly) {
+ parquetTableMetadataDirs = mapper.readValue(is,
ParquetTableMetadataDirs.class);
+ logger.info("Took {} ms to read directories from directory cache
file", timer.elapsed(TimeUnit.MILLISECONDS));
+ timer.stop();
+ if (!alreadyCheckedModification &&
tableModified(parquetTableMetadataDirs.getDirectories(), p, parentDir,
metaContext)) {
--- End diff --
While it is true that they are separate files, the REFRESH command would
have created them within a small time interval, so there is an assumption that
their modifications times are very close (unless a subdirectory is modified of
course..but in that case, we will call metaContext.clear() to invalidate the
cached information).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---