GitHub user xuchuanyin opened a pull request:
https://github.com/apache/carbondata/pull/2211 [CARBONDATA-2380][DataMap] Support visible/invisible datamap for performance tuning Support making datamap visible/invisible through session env. Invisible datamap will only be ignored during query and user can still see this datmap and its data will be updated as normal. We can specify a datamap as invisible by 'set carbon.datamap.invisible.dbName.tableName.dataMapName=false' and it is only effective in this session. Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [x] Any interfaces changed? `Add internal interface for getting visible datamaps` - [x] Any backward compatibility impacted? `NO` - [x] Document update required? `NO` - [x] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? `Test added` - How it is tested? Please attach test report. `Tested in local` - Is it a performance related change? Please attach the performance test report. `No` - Any additional information to help reviewers in testing this change. - [x] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. `Not related` You can merge this pull request into a Git repository by running: $ git pull https://github.com/xuchuanyin/carbondata 0423_invisible_datamap Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2211.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 #2211 ---- commit 88342ff4d370fa4f7e4809637f5977b3032e3c03 Author: xuchuanyin <xuchuanyin@...> Date: 2018-04-23T09:30:47Z Support visible/invisible datamap for performance tuning Support making datamap visible/invisible through session env. Invisible datamap will only be ignored during query and user can still see this datmap and its data will be updated as normal. We can specify a datamap as invisible by 'set carbon.datamap.invisible.dbName.tableName.dataMapName=false' and it is only effective in this session. ---- --- |
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2211 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4474/ --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183372282 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- Are you intend to make FG Datamap invisible? If yes, better to persistent this state by setting DataMapStatus in DataMapStatusDetail. --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183372467 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- And I think it is better to provide a statement for Disabling the datamap instead of a set command --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183375720 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- It's not going to disable the datamap forever. It is only intend to see how this datamap will enhance performance during the query. As described in PR description, "Invisible datamap will only be ignored during query and user can still see this datmap and its data will be updated as normal." It is named after MySQL document, and have the similar function as it. Please refer "MySQL now supports invisible indexes" in this link: https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183376339 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- ok, so you mean this is temporary only? Not needed to persist it, right? --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183378864 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- Having a statement to do this means that we need to store the related information. I also have considered to store the visible/invisible information in DataMapSchema/DataMapStatus related, but found that currently there is no place other than file to store them. Besides, this feature is introduced for tuning, which means the status may change frequently. Having a file stored information may need frequently refresh & read the DataMapSchemaFile. By using a set command here, we don't have to make the information durable. It meets our needs and can be implemented easily. @jackylk How do you think about it? --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2211 retest this please --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5328/ --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183411036 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- yes, it is temporary, no need to persist it. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4163/ --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2211 retest this please --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4182/ --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183604504 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- I think it is ok, please add a @InterfaceStability.Unstable to the property key you have introduced --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5351/ --- |
In reply to this post by qiuchenjian-2
Github user kumarvishal09 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r183828839 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- @xuchuanyin It is applicable for all type of data maps like pre aggregate, timeseries, etc?? --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2211#discussion_r184031116 --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java --- @@ -92,6 +95,30 @@ private DataMapStoreManager() { return dataMaps; } + /** + * It only gives the visible datamaps + */ + private List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { + CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); + List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); + Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); + while (dataMapIterator.hasNext()) { + TableDataMap dataMap = dataMapIterator.next(); + String dbName = carbonTable.getDatabaseName(); + String tableName = carbonTable.getTableName(); + String dmName = dataMap.getDataMapSchema().getDataMapName(); + boolean isDmVisible = sessionInfo.getSessionParams().getProperty( + String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, --- End diff -- @kumarvishal09 It 1. won't work on carbondata default datamap, such as DefaultBlockletDataMap/PreAggregate/Timeseries, 2. and will work for extened datamaps, such as LuceneDataMap/BloomDataMap The reason is that the visibility of datamap is done during blocklet pruning, it seems PreAggregate/Timeseries won't arrive there and DefaultBlockletDataMap will always come to effective. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4227/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2211 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5394/ --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2211 @jackylk All reviews are resolved --- |
Free forum by Nabble | Edit this page |