[ https://issues.apache.org/jira/browse/DRILL-7313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16877725#comment-16877725 ]
ASF GitHub Bot commented on DRILL-7313: --------------------------------------- arina-ielchiieva commented on pull request #1819: DRILL-7313: Use Hive schema for MaprDB native reader when field was empty URL: https://github.com/apache/drill/pull/1819#discussion_r299884454 ########## File path: exec/java-exec/src/main/java/org/apache/drill/metastore/FileSystemMetadataProviderManager.java ########## @@ -38,6 +41,34 @@ public static MetadataProviderManager init() { return new FileSystemMetadataProviderManager(); } + /** + * Returns {@link TableMetadataProvider} which provides specified schema. + * + * @param schema table schema which should be provided + * @return {@link TableMetadataProvider} which provides specified schema + * @throws IOException if exception during {@link TableMetadataProvider} construction happened + */ + public static TableMetadataProvider getMetadataProviderForSchema(TupleMetadata schema) throws IOException { + return new FileSystemMetadataProviderManager().builder(MetadataProviderKind.SCHEMA_STATS_ONLY) + .withSchema(schema) + .build(); + } + + /** + * Checks whether specified {@link MetadataProviderManager} is not null and returns {@link TableMetadataProvider} + * obtained from specified {@link MetadataProviderManager}. + * Otherwise {@link FileSystemMetadataProviderManager} is used for constructing {@link TableMetadataProvider}. + * + * @param providerManager metadata provider manager + * @return {@link MetadataProviderManager} instance + * @throws IOException if exception during {@link TableMetadataProvider} construction happened Review comment: ```suggestion * @throws IOException if exception has happened during {@link TableMetadataProvider} construction ``` ---------------------------------------------------------------- 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 > Use Hive schema for MaprDB native reader when field was empty > ------------------------------------------------------------- > > Key: DRILL-7313 > URL: https://issues.apache.org/jira/browse/DRILL-7313 > Project: Apache Drill > Issue Type: Task > Affects Versions: 1.16.0 > Reporter: Volodymyr Vysotskyi > Assignee: Volodymyr Vysotskyi > Priority: Major > Fix For: 1.17.0 > > > Currently, when an external Hive MaprDB table is queried using hive plugin > with enabled {{store.hive.maprdb_json.optimize_scan_with_native_reader}}, > some queries may fail due to soft schema change, though Hive knows actual > data types. > For example, when we have a table with several fields, and one of them has > only several non-null values, queries with grouping by such field will fail > due to schema change. > The goal of this Jira is to allow using types from Hive when a non-existing > field is created, so it will allow avoiding such issues. -- This message was sent by Atlassian JIRA (v7.6.3#76005)