You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by BJangir <gi...@git.apache.org> on 2018/01/29 18:18:51 UTC

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

GitHub user BJangir opened a pull request:

    https://github.com/apache/carbondata/pull/1878

    [CARBONDATA-2094] Filter DataMap Tables in Show Table Command

    Currently Show Table command shows datamap tables (agg tablels) but show table command should not show aggregate tables.
    
    Solution :- Handle "show table "command in carbon side and Filter the datamap table and return rest of  the tables.
    
    Be sure to do all of the following checklist to help us incorporate 
    your contribution quickly and easily:
    
     - [ ] Any interfaces changed? NO
     
     - [ ] Any backward compatibility impacted?
     NO
     - [ ] Document update required?
    NO
     - [ ] Testing done
            Please provide details on 
            - Whether new unit test cases have been added or why no new tests are required?
    UI Added
            - How it is tested? Please attach test report.
    UI added
            - Is it a performance related change? Please attach the performance test report.
     NA        
    - Any additional information to help reviewers in testing this change.
          NA 
     - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. 
    NA


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/BJangir/incubator-carbondata block_agg_display

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/carbondata/pull/1878.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 #1878
    
----
commit c5caa22a7cc6c164ac37cfe142c6516a4933b5bf
Author: BJangir <ba...@...>
Date:   2018-01-29T18:16:56Z

    [CARBONDATA-2094] Filter DataMap Tables in Show Table Command

----


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164654277
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse(""), tableIdent.table, isTemp)
    +    }
    +  }
    +
    +  private def filterDataMaps(tables: Seq[TableIdentifier],
    --- End diff --
    
    please add comment


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by BJangir <gi...@git.apache.org>.
Github user BJangir commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164813794
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    --- End diff --
    
    OK


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2095/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3236/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164653059
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    --- End diff --
    
    Use `CarbonEnv.getDatabaseName` instead


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r165807476
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggCreateCommand.scala ---
    @@ -270,6 +284,28 @@ class TestPreAggCreateCommand extends QueryTest with BeforeAndAfterAll {
         sql("DROP DATAMAP IF EXISTS agg0 ON TABLE maintable")
       }
     
    +  test("remove  agg tables from show table command") {
    +    sql("DROP TABLE IF EXISTS tbl_1")
    +    sql("create table if not exists  tbl_1(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) stored by 'carbondata' ")
    +    sql("create datamap agg1 on table tbl_1 using 'preaggregate' as select mac, sum(age) from tbl_1 group by mac")
    +    sql("create table if not exists  sparktable(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) ")
    +    checkExistence(sql("show tables"), false, "tbl_1_agg1")
    +    checkExistence(sql("show tables"), true, "sparktable","tbl_1")
    +  }
    +
    +
    +  test("remove TimeSeries agg tables from show table command") {
    +    sql("DROP TABLE IF EXISTS tbl_1")
    +    sql("create table if not exists  tbl_1(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) stored by 'carbondata' ")
    +    sql(
    +      "create datamap agg2 on table tbl_1 using 'preaggregate' DMPROPERTIES ('timeseries" +
    --- End diff --
    
    we don't support create timeseries table like this :  'timeseries.eventTime'='prodate', 'timeseries.hierarchy'


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    LGTM


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    There are many test case is unuseful/invalid after you change the function of  "show tables"



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r165567560
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggregateDrop.scala ---
    @@ -84,7 +86,8 @@ class TestPreAggregateDrop extends QueryTest with BeforeAndAfterAll {
         sql("create datamap preagg_same1 on table maintable using 'preaggregate' as select" +
             " a,sum(c) from maintable group by a")
         showTables = sql("show tables")
    --- End diff --
    
    remove this line


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164653281
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse(""), tableIdent.table, isTemp)
    --- End diff --
    
    `tableIdent.database.getOrElse("")` is not right, default database is `default`


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3294/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r165037072
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonShowTablesCommand.scala ---
    @@ -0,0 +1,78 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class CarbonShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse("default"), tableIdent.table, isTemp)
    +    }
    +  }
    +
    +  /**
    +   *
    +   * @param tables tableIdnetifers
    +   * @param sparkSession sparksession
    +   * @return  Tables after filter datamap tables
    +   */
    +  private def filterDataMaps(tables: Seq[TableIdentifier],
    +      sparkSession: SparkSession): Seq[TableIdentifier] = {
    +    // Filter carbon Tables then get CarbonTable and getDataMap List and filter the same
    +    // as of now 2 times lookup is happening(filter  carbon table ,getDataMapList)
    +    // <todo> add another PR (CARBONDATA-2103) to improve  with 1 lookup
    --- End diff --
    
    change to `TODO`


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164652631
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    --- End diff --
    
    Change to `CarbonShowTablesCommand` like other commands


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r166847806
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggregateDrop.scala ---
    @@ -46,8 +46,9 @@ class TestPreAggregateDrop extends QueryTest with BeforeAndAfterAll {
           " a,sum(c) from maintable group by a")
         sql("drop datamap if exists preagg2 on table maintable")
         val showTables = sql("show tables")
    +    val showdatamaps =sql("show datamap on table maintable")
         checkExistence(showTables, false, "maintable_preagg2")
    --- End diff --
    
    for example:
    
      test("dropping 1 aggregate table should not drop others") {
         sql(
           "create datamap preagg1 on table maintable using 'preaggregate' as select" +
           " a,sum(b) from maintable group by a")
         sql(
           "create datamap preagg2 on table maintable using 'preaggregate' as select" +
           " a,sum(c) from maintable group by a")
         sql("drop datamap if exists preagg2 on table maintable")
         val showTables = sql("show tables")
         checkExistence(showTables, false, "maintable_preagg2")
    
    showTables will always not contain maintable_preagg2, so we need adapt new show table function. There are some test case need check again.  @BJangir @jackylk @chenliang613 @sraghunandan @ravipesala 


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2056/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3277/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164652985
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggCreateCommand.scala ---
    @@ -212,6 +212,21 @@ class TestPreAggCreateCommand extends QueryTest with BeforeAndAfterAll {
         sql("drop datamap agg0 on table maintable")
       }
     
    +  test("remove agg tables from show table command") {
    +    sql("DROP TABLE IF EXISTS tbl_1")
    +    sql("DROP TABLE IF EXISTS sparktable")
    +    sql("create table if not exists  tbl_1(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) stored by 'carbondata' ")
    +    sql("create table if not exists sparktable(a int,b string)")
    +    sql(
    +      s"""create datamap preagg_sum on table tbl_1 using 'preaggregate' as select mac,avg(age) from tbl_1 group by mac"""
    +        .stripMargin)
    +    sql(
    +      "create datamap agg2 on table tbl_1 using 'preaggregate' DMPROPERTIES ('timeseries" +
    --- End diff --
    
    Please split this testcase into two testcases, one for preaggregation datamap, another for time series datamap


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r166847284
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggregateDrop.scala ---
    @@ -46,8 +46,9 @@ class TestPreAggregateDrop extends QueryTest with BeforeAndAfterAll {
           " a,sum(c) from maintable group by a")
         sql("drop datamap if exists preagg2 on table maintable")
         val showTables = sql("show tables")
    +    val showdatamaps =sql("show datamap on table maintable")
         checkExistence(showTables, false, "maintable_preagg2")
    --- End diff --
    
    this test case is invalid after you change the function of "show tables


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    retest this please


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3413/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r166848593
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggCreateCommand.scala ---
    @@ -216,6 +216,20 @@ class TestPreAggCreateCommand extends QueryTest with BeforeAndAfterAll {
       }
     
       val timeSeries = TIMESERIES.toString
    +  test("remove agg tables from show table command") {
    +    sql("DROP TABLE IF EXISTS tbl_1")
    +    sql("DROP TABLE IF EXISTS sparktable")
    +    sql("create table if not exists  tbl_1(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) stored by 'carbondata' ")
    +    sql("create table if not exists sparktable(a int,b string)")
    +    sql(
    +      s"""create datamap preagg_sum on table tbl_1 using 'preaggregate' as select mac,avg(age) from tbl_1 group by mac"""
    +        .stripMargin)
    +    sql(
    +      "create datamap agg2 on table tbl_1 using 'preaggregate' DMPROPERTIES ('timeseries" +
    +      ".eventTime'='prodate', 'timeseries.hierarchy'='hour=1,day=1,month=1,year=1') as select prodate," +
    --- End diff --
    
    I fix it on https://github.com/apache/carbondata/pull/1929, please review it @BJangir @jackylk @ravipesala @sraghunandan 


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3331/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164654501
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse(""), tableIdent.table, isTemp)
    +    }
    +  }
    +
    +  private def filterDataMaps(tables: Seq[TableIdentifier],
    +      sparkSession: SparkSession): Seq[TableIdentifier] = {
    +    // Filter carbon Tables then get CarbonTable and getDataMap List and filter the same
    +    // as of now 2 times lookup is happening(filter  carbon table ,getDataMapList)
    +    // <todo> add another PR to improve  with 1 lookup
    +    val allDatamapTable = tables.filter(tbs => {
    --- End diff --
    
    `tables.filter(tbs => {` change to 
    `tables.filter { table =>`


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r165807488
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggCreateCommand.scala ---
    @@ -216,6 +216,20 @@ class TestPreAggCreateCommand extends QueryTest with BeforeAndAfterAll {
       }
     
       val timeSeries = TIMESERIES.toString
    +  test("remove agg tables from show table command") {
    +    sql("DROP TABLE IF EXISTS tbl_1")
    +    sql("DROP TABLE IF EXISTS sparktable")
    +    sql("create table if not exists  tbl_1(imei string,age int,mac string ,prodate timestamp,update timestamp,gamepoint double,contrid double) stored by 'carbondata' ")
    +    sql("create table if not exists sparktable(a int,b string)")
    +    sql(
    +      s"""create datamap preagg_sum on table tbl_1 using 'preaggregate' as select mac,avg(age) from tbl_1 group by mac"""
    +        .stripMargin)
    +    sql(
    +      "create datamap agg2 on table tbl_1 using 'preaggregate' DMPROPERTIES ('timeseries" +
    +      ".eventTime'='prodate', 'timeseries.hierarchy'='hour=1,day=1,month=1,year=1') as select prodate," +
    --- End diff --
    
    we don't support create timeseries table like this now : 'timeseries.eventTime'='prodate', 'timeseries.hierarchy'


---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by BJangir <gi...@git.apache.org>.
Github user BJangir closed the pull request at:

    https://github.com/apache/carbondata/pull/1878


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2176/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3364/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r165037118
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonShowTablesCommand.scala ---
    @@ -0,0 +1,78 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class CarbonShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse("default"), tableIdent.table, isTemp)
    +    }
    +  }
    +
    +  /**
    +   *
    +   * @param tables tableIdnetifers
    +   * @param sparkSession sparksession
    +   * @return  Tables after filter datamap tables
    +   */
    +  private def filterDataMaps(tables: Seq[TableIdentifier],
    +      sparkSession: SparkSession): Seq[TableIdentifier] = {
    +    // Filter carbon Tables then get CarbonTable and getDataMap List and filter the same
    +    // as of now 2 times lookup is happening(filter  carbon table ,getDataMapList)
    +    // <todo> add another PR (CARBONDATA-2103) to improve  with 1 lookup
    +    val allDatamapTable = tables.filter(table => {
    --- End diff --
    
    the code style is not changed yet


---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2002/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3192/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2128/



---

[GitHub] carbondata issue #1878: [CARBONDATA-2094] Filter DataMap Tables in Show Tabl...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1878
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3258/



---

[GitHub] carbondata pull request #1878: [CARBONDATA-2094] Filter DataMap Tables in Sh...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1878#discussion_r164654398
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/ShowTablesCommand.scala ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.execution.command.table
    +
    +import scala.collection.JavaConverters._
    +
    +import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference}
    +import org.apache.spark.sql.execution.command.MetadataCommand
    +import org.apache.spark.sql.types.{BooleanType, StringType}
    +
    +
    +private[sql] case class ShowTablesCommand ( databaseName: Option[String],
    +    tableIdentifierPattern: Option[String])  extends MetadataCommand{
    +
    +  // The result of SHOW TABLES has three columns: database, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    AttributeReference("database", StringType, nullable = false)() ::
    +    AttributeReference("tableName", StringType, nullable = false)() ::
    +    AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil
    +  }
    +
    +  override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables directly
    +    // instead of calling tables in sparkSession.
    +    // filterDataMaps Method is to Filter the Table.
    +    val catalog = sparkSession.sessionState.catalog
    +    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
    +    var tables =
    +      tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
    +    tables = filterDataMaps(tables, sparkSession)
    +    tables.map { tableIdent =>
    +      val isTemp = catalog.isTemporaryTable(tableIdent)
    +      Row(tableIdent.database.getOrElse(""), tableIdent.table, isTemp)
    +    }
    +  }
    +
    +  private def filterDataMaps(tables: Seq[TableIdentifier],
    +      sparkSession: SparkSession): Seq[TableIdentifier] = {
    +    // Filter carbon Tables then get CarbonTable and getDataMap List and filter the same
    +    // as of now 2 times lookup is happening(filter  carbon table ,getDataMapList)
    +    // <todo> add another PR to improve  with 1 lookup
    --- End diff --
    
    change <todo> to TODO
    and add the JIRA number here


---