Github user chenerlu commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/877#discussion_r115928432 --- Diff: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/createtable/TestCreateTableSyntax.scala --- @@ -31,7 +36,60 @@ class TestCreateTableSyntax extends QueryTest with BeforeAndAfterAll { override def beforeAll { } + test("test carbon table create with bitmap column") { + + sql("drop table if exists carbontable") + sql(""" + CREATE TABLE IF NOT EXISTS carbontable + (ID Int, date Date, country String, + name String, phonetype String, serialname char(10), salary Int) + STORED BY 'carbondata' + TBLPROPERTIES ('BITMAP'='name,country') + """) + val dataBaseName = "default" + val tableName = "carbontable" + val carbonRelation = CarbonEnv.get.carbonMetastore.lookupRelation1(Option(dataBaseName), + tableName)(sqlContext).asInstanceOf[CarbonRelation] + val carbonTable = carbonRelation.tableMeta.carbonTable + val dimensions = carbonTable.getDimensionByTableName(tableName.toLowerCase()) + .toArray.map(_.asInstanceOf[CarbonDimension]) + assert(dimensions(1).getColumnSchema.getColumnName.equals("country")) + assert(dimensions(2).getColumnSchema.getColumnName.equals("name")) + assert(dimensions(1).getColumnSchema.hasEncoding(Encoding.BITMAP)) + assert(dimensions(2).getColumnSchema.hasEncoding(Encoding.BITMAP)) + } + test("test carbon table create with bitmap group column") { + try { + sql("drop table if exists carbontable") + sql(""" + CREATE TABLE IF NOT EXISTS carbontable + (ID Int, date Date, country String, + name String, phonetype String, serialname char(10), salary Int) + STORED BY 'carbondata' + TBLPROPERTIES ('BITMAP'='country,phonetype','COLUMN_GROUPS'='(country,name)') + """) + } catch { + case e : Exception => { + assert(e.getMessage.equals("bitmap encoding column can\'t be a group column")) + } + } + } + test("test carbon table create with no dictionary bitmap column") { --- End diff -- add drop table before create a table . --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
Free forum by Nabble | Edit this page |