GitHub user xuchuanyin opened a pull request:
https://github.com/apache/carbondata/pull/2405 [CARBONDATA-2635][BloomDataMap] Support different provider based index datamaps on same column User can create different provider based index datamaps on one column, for example user can create bloomfilter datamap and lucene datamap on one column, but not able to create two bloomfilter datamap on one column. Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [] Any interfaces changed? - [ ] Any backward compatibility impacted? - [ ] Document update required? - [ ] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? - How it is tested? Please attach test report. - Is it a performance related change? Please attach the performance test report. - Any additional information to help reviewers in testing this change. - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. You can merge this pull request into a Git repository by running: $ git pull https://github.com/xuchuanyin/carbondata 0624_index_dm_same_column Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2405.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 #2405 ---- commit 9a41e7a16cce226b2b7a00cafc5b7b9660b546f9 Author: xuchuanyin <xuchuanyin@...> Date: 2018-06-24T04:47:21Z Support different provider based index datamaps on same column User can create different provider based index datamaps on one column, for example user can create bloomfilter datamap and lucene datamap on one column, but not able to create two bloomfilter datamap on one column. ---- --- |
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2405 SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5413/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2405 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6492/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2405 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5323/ --- |
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/2405#discussion_r198055814 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala --- @@ -99,17 +97,22 @@ case class CarbonCreateDataMapCommand( dataMapProvider match { case provider: IndexDataMapProvider => val datamaps = DataMapStoreManager.getInstance.getAllDataMap(mainTable).asScala - val existingIndexColumn = mutable.Set[String]() - datamaps.foreach { datamap => - datamap.getDataMapSchema.getIndexColumns.foreach(existingIndexColumn.add) + val existingIndexColumn4ThisProvider = mutable.Set[String]() + val thisDmProviderName = + dataMapProvider.asInstanceOf[IndexDataMapProvider].getDataMapSchema.getProviderName + datamaps.filter(datamap => thisDmProviderName.equalsIgnoreCase( + datamap.getDataMapSchema.getProviderName)).foreach { datamap => --- End diff -- format the code like ``` datamaps.filter { datamap => ... }.map { datamap => ... } ``` --- |
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/2405#discussion_r198123518 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala --- @@ -99,17 +97,22 @@ case class CarbonCreateDataMapCommand( dataMapProvider match { case provider: IndexDataMapProvider => val datamaps = DataMapStoreManager.getInstance.getAllDataMap(mainTable).asScala - val existingIndexColumn = mutable.Set[String]() - datamaps.foreach { datamap => - datamap.getDataMapSchema.getIndexColumns.foreach(existingIndexColumn.add) + val existingIndexColumn4ThisProvider = mutable.Set[String]() + val thisDmProviderName = + dataMapProvider.asInstanceOf[IndexDataMapProvider].getDataMapSchema.getProviderName + datamaps.filter(datamap => thisDmProviderName.equalsIgnoreCase( + datamap.getDataMapSchema.getProviderName)).foreach { datamap => --- End diff -- fixed~ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2405 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6565/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2405 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5394/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2405 SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5467/ --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2405 @jackylk comments are resolved --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:
https://github.com/apache/carbondata/pull/2405 Can you modify the PR title: Support create different index datamaps on same column --- |
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/2405#discussion_r199043918 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datamap/TestDataMapCommand.scala --- @@ -287,6 +287,57 @@ class TestDataMapCommand extends QueryTest with BeforeAndAfterAll { sql("drop table main") } + test("test create datamap: unable to create same index datamap for one column") { + sql("DROP TABLE IF EXISTS datamap_test_table") + sql( + """ + | CREATE TABLE datamap_test_table(id INT, name STRING, city STRING, age INT) + | STORED BY 'carbondata' + | TBLPROPERTIES('SORT_COLUMNS'='city,name', 'SORT_SCOPE'='LOCAL_SORT') + """.stripMargin) + val exception_duplicate_column: Exception = intercept[MalformedDataMapCommandException] { + sql( + s""" + | CREATE DATAMAP dm ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm1 ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + } + assertResult("column 'name' already has lucene index datamap created")(exception_duplicate_column.getMessage) + sql("drop table if exists datamap_test_table") + } + + test("test create datamap: able to create different index datamap for one column") { + sql("DROP TABLE IF EXISTS datamap_test_table") + sql( + """ + | CREATE TABLE datamap_test_table(id INT, name STRING, city STRING, age INT) + | STORED BY 'carbondata' + | TBLPROPERTIES('SORT_COLUMNS'='city,name', 'SORT_SCOPE'='LOCAL_SORT') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm1 ON TABLE datamap_test_table + | USING 'bloomfilter' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql("show datamap on table datamap_test_table").show(false) + checkExistence(sql("show datamap on table datamap_test_table"), true, "dm", "dm1", "lucene", "bloomfilter") --- End diff -- can you add assert to check data map selection for the query also, by using explain statement --- |
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/2405#discussion_r199065882 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datamap/TestDataMapCommand.scala --- @@ -287,6 +287,57 @@ class TestDataMapCommand extends QueryTest with BeforeAndAfterAll { sql("drop table main") } + test("test create datamap: unable to create same index datamap for one column") { + sql("DROP TABLE IF EXISTS datamap_test_table") + sql( + """ + | CREATE TABLE datamap_test_table(id INT, name STRING, city STRING, age INT) + | STORED BY 'carbondata' + | TBLPROPERTIES('SORT_COLUMNS'='city,name', 'SORT_SCOPE'='LOCAL_SORT') + """.stripMargin) + val exception_duplicate_column: Exception = intercept[MalformedDataMapCommandException] { + sql( + s""" + | CREATE DATAMAP dm ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm1 ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + } + assertResult("column 'name' already has lucene index datamap created")(exception_duplicate_column.getMessage) + sql("drop table if exists datamap_test_table") + } + + test("test create datamap: able to create different index datamap for one column") { + sql("DROP TABLE IF EXISTS datamap_test_table") + sql( + """ + | CREATE TABLE datamap_test_table(id INT, name STRING, city STRING, age INT) + | STORED BY 'carbondata' + | TBLPROPERTIES('SORT_COLUMNS'='city,name', 'SORT_SCOPE'='LOCAL_SORT') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm ON TABLE datamap_test_table + | USING 'lucene' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql( + s""" + | CREATE DATAMAP dm1 ON TABLE datamap_test_table + | USING 'bloomfilter' + | DMProperties('INDEX_COLUMNS'='name') + """.stripMargin) + sql("show datamap on table datamap_test_table").show(false) + checkExistence(sql("show datamap on table datamap_test_table"), true, "dm", "dm1", "lucene", "bloomfilter") --- End diff -- Currently in carbondata, if we have multiple indexdatamap, the explain result will only show the first datamap and the other datamap will not be shown. PR #2411 is raised to solve this problem --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2405 @jackylk review comments are resolved --- |
In reply to this post by qiuchenjian-2
|
In reply to this post by qiuchenjian-2
|
Free forum by Nabble | Edit this page |