[GitHub] incubator-carbondata pull request #263: [CARBONDATA-2][WIP] Data load integr...
Github user ravipesala commented on a diff in the pull request: https://github.com/apache/incubator-carbondata/pull/263#discussion_r85923089 --- Diff: integration/spark/src/main/java/org/apache/carbondata/spark/load/CarbonLoaderUtil.java --- @@ -213,6 +224,64 @@ public static void executeGraph(CarbonLoadModel loadModel, String storeLocation, info, loadModel.getPartitionId(), loadModel.getCarbonDataLoadSchema()); } + public static void executeNewDataLoad(CarbonLoadModel loadModel, String storeLocation, + String hdfsStoreLocation, RecordReader[] recordReaders) + throws Exception { +if (!new File(storeLocation).mkdirs()) { + LOGGER.error("Error while creating the temp store path: " + storeLocation); +} +CarbonDataLoadConfiguration configuration = new CarbonDataLoadConfiguration(); +String databaseName = loadModel.getDatabaseName(); +String tableName = loadModel.getTableName(); +String tempLocationKey = databaseName + CarbonCommonConstants.UNDERSCORE + tableName ++ CarbonCommonConstants.UNDERSCORE + loadModel.getTaskNo(); +CarbonProperties.getInstance().addProperty(tempLocationKey, storeLocation); +CarbonProperties.getInstance() +.addProperty(CarbonCommonConstants.STORE_LOCATION_HDFS, hdfsStoreLocation); +// CarbonProperties.getInstance().addProperty("store_output_location", outPutLoc); +CarbonProperties.getInstance().addProperty("send.signal.load", "false"); + +CarbonTable carbonTable = loadModel.getCarbonDataLoadSchema().getCarbonTable(); +AbsoluteTableIdentifier identifier = +carbonTable.getAbsoluteTableIdentifier(); +configuration.setTableIdentifier(identifier); +String csvHeader = loadModel.getCsvHeader(); +if (csvHeader != null && !csvHeader.isEmpty()) { + configuration.setHeader(CarbonDataProcessorUtil.getColumnFields(csvHeader, ",")); +} else { + CarbonFile csvFile = + CarbonDataProcessorUtil.getCsvFileToRead(loadModel.getFactFilesToProcess().get(0)); + configuration + .setHeader(CarbonDataProcessorUtil.getFileHeader(csvFile, loadModel.getCsvDelimiter())); +} + +configuration.setPartitionId(loadModel.getPartitionId()); +configuration.setSegmentId(loadModel.getSegmentId()); +configuration.setTaskNo(loadModel.getTaskNo()); + configuration.setDataLoadProperty(DataLoadProcessorConstants.COMPLEX_DELIMITERS, +new String[] { loadModel.getComplexDelimiterLevel1(), +loadModel.getComplexDelimiterLevel2() }); +List dimensions = + carbonTable.getDimensionByTableName(carbonTable.getFactTableName()); +List measures = +carbonTable.getMeasureByTableName(carbonTable.getFactTableName()); +DataField[] dataFields = new DataField[dimensions.size() + measures.size()]; + +int i = 0; +for (CarbonColumn column : dimensions) { + dataFields[i++] = new DataField(column); +} +for (CarbonColumn column : measures) { + dataFields[i++] = new DataField(column); +} +Iterator[] iterators = new RecordReaderIterator[recordReaders.length]; +configuration.setDataFields(dataFields); +for (int j = 0; j < recordReaders.length; j++) { + iterators[j] = new RecordReaderIterator(recordReaders[j]); +} +new DataLoadProcessExecutor().execute(configuration, iterators); --- End diff -- yes, we can use but here it is little customized api to take list of iterators/recordreaders to process parallely. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-carbondata pull request #263: [CARBONDATA-2][WIP] Data load integr...
Github user jackylk commented on a diff in the pull request: https://github.com/apache/incubator-carbondata/pull/263#discussion_r85757712 --- Diff: integration/spark/src/main/java/org/apache/carbondata/spark/load/CarbonLoaderUtil.java --- @@ -213,6 +224,64 @@ public static void executeGraph(CarbonLoadModel loadModel, String storeLocation, info, loadModel.getPartitionId(), loadModel.getCarbonDataLoadSchema()); } + public static void executeNewDataLoad(CarbonLoadModel loadModel, String storeLocation, + String hdfsStoreLocation, RecordReader[] recordReaders) + throws Exception { +if (!new File(storeLocation).mkdirs()) { + LOGGER.error("Error while creating the temp store path: " + storeLocation); +} +CarbonDataLoadConfiguration configuration = new CarbonDataLoadConfiguration(); +String databaseName = loadModel.getDatabaseName(); +String tableName = loadModel.getTableName(); +String tempLocationKey = databaseName + CarbonCommonConstants.UNDERSCORE + tableName ++ CarbonCommonConstants.UNDERSCORE + loadModel.getTaskNo(); +CarbonProperties.getInstance().addProperty(tempLocationKey, storeLocation); +CarbonProperties.getInstance() +.addProperty(CarbonCommonConstants.STORE_LOCATION_HDFS, hdfsStoreLocation); +// CarbonProperties.getInstance().addProperty("store_output_location", outPutLoc); +CarbonProperties.getInstance().addProperty("send.signal.load", "false"); + +CarbonTable carbonTable = loadModel.getCarbonDataLoadSchema().getCarbonTable(); +AbsoluteTableIdentifier identifier = +carbonTable.getAbsoluteTableIdentifier(); +configuration.setTableIdentifier(identifier); +String csvHeader = loadModel.getCsvHeader(); +if (csvHeader != null && !csvHeader.isEmpty()) { + configuration.setHeader(CarbonDataProcessorUtil.getColumnFields(csvHeader, ",")); +} else { + CarbonFile csvFile = + CarbonDataProcessorUtil.getCsvFileToRead(loadModel.getFactFilesToProcess().get(0)); + configuration + .setHeader(CarbonDataProcessorUtil.getFileHeader(csvFile, loadModel.getCsvDelimiter())); +} + +configuration.setPartitionId(loadModel.getPartitionId()); +configuration.setSegmentId(loadModel.getSegmentId()); +configuration.setTaskNo(loadModel.getTaskNo()); + configuration.setDataLoadProperty(DataLoadProcessorConstants.COMPLEX_DELIMITERS, +new String[] { loadModel.getComplexDelimiterLevel1(), +loadModel.getComplexDelimiterLevel2() }); +List dimensions = + carbonTable.getDimensionByTableName(carbonTable.getFactTableName()); +List measures = +carbonTable.getMeasureByTableName(carbonTable.getFactTableName()); +DataField[] dataFields = new DataField[dimensions.size() + measures.size()]; + +int i = 0; +for (CarbonColumn column : dimensions) { + dataFields[i++] = new DataField(column); +} +for (CarbonColumn column : measures) { + dataFields[i++] = new DataField(column); +} +Iterator[] iterators = new RecordReaderIterator[recordReaders.length]; +configuration.setDataFields(dataFields); +for (int j = 0; j < recordReaders.length; j++) { + iterators[j] = new RecordReaderIterator(recordReaders[j]); +} +new DataLoadProcessExecutor().execute(configuration, iterators); --- End diff -- should have a CarbonTableOutputFormat and use it here, right? --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-carbondata pull request #263: [CARBONDATA-2][WIP] Data load integr...
GitHub user ravipesala opened a pull request: https://github.com/apache/incubator-carbondata/pull/263 [CARBONDATA-2][WIP] Data load integration of all steps for removing kettle This PR integrates all data load steps to the main flow. Still DataWriterStep need to be integrated.And testing is pending. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ravipesala/incubator-carbondata data-load-integration Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-carbondata/pull/263.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #263 commit c4bd3a14e3e1f437d365c9f9e4dc21b2d69f56ec Author: ravipesalaDate: 2016-10-27T03:44:32Z WIP Integrating new dataloading flow commit 6aa1e738c02e2906b43b372bcad0ed8096962ddf Author: ravipesala Date: 2016-10-27T12:41:11Z Integrated data processor steps to new flow. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---