[ https://issues.apache.org/jira/browse/DRILL-7330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17062737#comment-17062737 ]
ASF GitHub Bot commented on DRILL-7330: --------------------------------------- vvysotskyi commented on pull request #2026: DRILL-7330: Implement metadata usage for all format plugins URL: https://github.com/apache/drill/pull/2026#discussion_r395078523 ########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/ColumnExplorer.java ########## @@ -292,39 +289,86 @@ public static int getPartitionDepth(FileSelection selection) { * @param includeFileImplicitColumns if file implicit columns should be included into the result * @param fs file system * @param index index of row group to populate + * @param start start of row group to populate + * @param length length of row group to populate * @return implicit columns map */ public Map<String, String> populateImplicitAndInternalColumns(Path filePath, List<String> partitionValues, boolean includeFileImplicitColumns, FileSystem fs, int index, long start, long length) { Map<String, String> implicitValues = - new LinkedHashMap<>(populateImplicitColumns(filePath, partitionValues, includeFileImplicitColumns)); + new LinkedHashMap<>(populateImplicitAndInternalColumns(filePath, partitionValues, includeFileImplicitColumns, fs)); - selectedInternalColumns.forEach((key, value) -> { - switch (value) { + selectedInternalColumns.forEach( + (key, value) -> implicitValues.put(key, getImplicitColumnValue(value, filePath, fs, index, start, length))); + + return implicitValues; + } + + /** + * Returns implicit column value for specified implicit file column. + * + * @param column implicit file column + * @param filePath file path, used to populate file implicit columns + * @param fs file system + * @param index row group index + * @param start row group start + * @param length row group length + * @return implicit column value for specified implicit file column + */ + private static String getImplicitColumnValue(ImplicitFileColumn column, Path filePath, + FileSystem fs, Integer index, Long start, Long length) { + if (column instanceof ImplicitFileColumns) { + ImplicitFileColumns fileColumn = (ImplicitFileColumns) column; + return fileColumn.getValue(filePath); + } else if (column instanceof ImplicitInternalFileColumns) { + ImplicitInternalFileColumns fileColumn = (ImplicitInternalFileColumns) column; + switch (fileColumn) { case ROW_GROUP_INDEX: - implicitValues.put(key, String.valueOf(index)); - break; + return index != null ? String.valueOf(index) : null; case ROW_GROUP_START: - implicitValues.put(key, String.valueOf(start)); - break; + return start != null ? String.valueOf(start) : null; case ROW_GROUP_LENGTH: - implicitValues.put(key, String.valueOf(length)); - break; + return length != null ? String.valueOf(length) : null; case PROJECT_METADATA: - implicitValues.put(key, Boolean.TRUE.toString()); - break; + return Boolean.TRUE.toString(); case LAST_MODIFIED_TIME: try { - implicitValues.put(key, String.valueOf(fs.getFileStatus(filePath).getModificationTime())); + return fs != null ? String.valueOf(fs.getFileStatus(filePath).getModificationTime()) : null; Review comment: Ok, thanks! ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Implement metadata usage for text format plugin > ----------------------------------------------- > > Key: DRILL-7330 > URL: https://issues.apache.org/jira/browse/DRILL-7330 > Project: Apache Drill > Issue Type: Sub-task > Reporter: Arina Ielchiieva > Assignee: Vova Vysotskyi > Priority: Major > Fix For: 1.18.0 > > > 1. Change the current group scan to leverage Schema from Metastore; > 2. Use stats for enabling additional logical planning rules for text format > plugin. It will enable such optimizations as limit, filter push and so on. > + add possibility to pass schema through schema file (using path or table > root), inline. > + check for other enhancements in analyze command -- This message was sent by Atlassian Jira (v8.3.4#803005)