ajantha-bhat commented on a change in pull request #3583: [CARBONDATA-3687]
Support writing non-transactional carbondata files through hive
URL: https://github.com/apache/carbondata/pull/3583#discussion_r388148584
##########
File path:
integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonInputFormat.java
##########
@@ -88,12 +89,23 @@ private static void populateCarbonTable(Configuration
configuration, String path
}
}
}
- if (null != validInputPath) {
- AbsoluteTableIdentifier absoluteTableIdentifier = AbsoluteTableIdentifier
- .from(validInputPath, getDatabaseName(configuration),
getTableName(configuration));
+ if (null != paths) {
// read the schema file to get the absoluteTableIdentifier having the
correct table id
// persisted in the schema
- CarbonTable carbonTable =
SchemaReader.readCarbonTableFromStore(absoluteTableIdentifier);
+ CarbonTable carbonTable;
+ AbsoluteTableIdentifier absoluteTableIdentifier = AbsoluteTableIdentifier
+ .from(validInputPath, getDatabaseName(configuration),
getTableName(configuration));
+ String schemaPath = CarbonTablePath.getSchemaFilePath(validInputPath);
+ if (FileFactory.getCarbonFile(schemaPath).exists()) {
+ // read the schema file to get the absoluteTableIdentifier having the
correct table id
+ // persisted in the schema
+ carbonTable =
SchemaReader.readCarbonTableFromStore(absoluteTableIdentifier);
+ } else {
+ // InferSchema from data file
+ carbonTable = CarbonTable.buildFromTableInfo(SchemaReader
+ .inferSchema(absoluteTableIdentifier, false));
+ carbonTable.setTransactionalTable(true);
Review comment:
If shema doesn't exists, will it be non-transactional table ?
can you add comment why it is set as transactional ?
----------------------------------------------------------------
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