arina-ielchiieva commented on a change in 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_r299877983
##########
File path:
contrib/storage-hive/core/scrMapr/main/java/org/apache/drill/exec/planner/sql/logical/ConvertHiveMapRDBJsonScanToDrillMapRDBJsonScan.java
##########
@@ -114,23 +123,35 @@ Hive does not always give correct costing (i.e. for
external tables Hive does no
/**
* Helper method which creates a DrillScanRel with native Drill HiveScan.
*/
- private DrillScanRel createNativeScanRel(DrillScanRel hiveScanRel,
PlannerSettings settings) {
+ private DrillScanRel createNativeScanRel(DrillScanRel hiveScanRel,
PlannerSettings settings) throws IOException {
RelDataTypeFactory typeFactory = hiveScanRel.getCluster().getTypeFactory();
HiveScan hiveScan = (HiveScan) hiveScanRel.getGroupScan();
- Map<String, String> parameters =
hiveScan.getHiveReadEntry().getHiveTableWrapper().getParameters();
+ HiveReadEntry hiveReadEntry = hiveScan.getHiveReadEntry();
+ Map<String, String> parameters =
hiveReadEntry.getHiveTableWrapper().getParameters();
JsonScanSpec scanSpec = new
JsonScanSpec(parameters.get(MAPRDB_TABLE_NAME), null, null);
List<SchemaPath> hiveScanCols = hiveScanRel.getColumns().stream()
.map(colNameSchemaPath -> replaceOverriddenSchemaPath(parameters,
colNameSchemaPath))
.collect(Collectors.toList());
+
+ HiveToRelDataTypeConverter dataTypeConverter = new
HiveToRelDataTypeConverter(typeFactory);
+ TupleSchema schema = new TupleSchema();
+ List<FieldSchema> tableSchemaColumns =
hiveReadEntry.getTable().getColumnListsCache().getTableSchemaColumns();
+ tableSchemaColumns.forEach(column ->
+ SchemaPathUtils.addColumnMetadata(schema,
Review comment:
Please add better javadoc to `SchemaPathUtils#addColumnMetadata`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services