[GitHub] incubator-carbondata pull request #540: [WIP] Add data update and deletion e...

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [WIP] Add data update and deletion e...

qiuchenjian-2
GitHub user chenliang613 opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/540

    [WIP] Add data update and deletion example

    Add data update and deletion example

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

    $ git pull https://github.com/chenliang613/incubator-carbondata iud-example

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

    https://github.com/apache/incubator-carbondata/pull/540.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 #540
   
----
commit b2293091df394f8d09836a6ed15bcce66528869c
Author: chenliang613 <[hidden email]>
Date:   2017-01-16T08:07:09Z

    add data update and deletion example

----


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [WIP] Add data update and deletion example

qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/623/



---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/540#discussion_r96591999
 
    --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/DataUpdateDeleteExample.scala ---
    @@ -0,0 +1,81 @@
    +/*
    + * 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.carbondata.examples
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.examples.util.ExampleUtils
    +
    +object DataUpdateDeleteExample {
    +
    +  def main(args: Array[String]) {
    +    val cc = ExampleUtils.createCarbonContext("DataUpdateDeleteExample")
    +    val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv"
    +
    +    // Specify timestamp format based on raw data
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
    +
    +    cc.sql("DROP TABLE IF EXISTS t3")
    +
    +    // Create table, 6 dimensions, 1 measure
    +    cc.sql("""
    +           CREATE TABLE IF NOT EXISTS t3
    +           (ID Int, date Timestamp, country String,
    +           name String, phonetype String, serialname char(10), salary Int)
    +           STORED BY 'carbondata'
    +           """)
    +
    +    cc.sql(s"""
    +           LOAD DATA LOCAL INPATH '$testData' into table t3
    +           """)
    +
    +    // Query data before update and deletion
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Delete data where salary > 15005
    +    cc.sql("""
    +           delete FROM t3 where salary > 15005
    --- End diff --
   
    Please use capital letters


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/540#discussion_r96591995
 
    --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/DataUpdateDeleteExample.scala ---
    @@ -0,0 +1,81 @@
    +/*
    + * 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.carbondata.examples
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.examples.util.ExampleUtils
    +
    +object DataUpdateDeleteExample {
    +
    +  def main(args: Array[String]) {
    +    val cc = ExampleUtils.createCarbonContext("DataUpdateDeleteExample")
    +    val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv"
    +
    +    // Specify timestamp format based on raw data
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
    +
    +    cc.sql("DROP TABLE IF EXISTS t3")
    +
    +    // Create table, 6 dimensions, 1 measure
    +    cc.sql("""
    +           CREATE TABLE IF NOT EXISTS t3
    +           (ID Int, date Timestamp, country String,
    +           name String, phonetype String, serialname char(10), salary Int)
    +           STORED BY 'carbondata'
    +           """)
    +
    +    cc.sql(s"""
    +           LOAD DATA LOCAL INPATH '$testData' into table t3
    +           """)
    +
    +    // Query data before update and deletion
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Delete data where salary > 15005
    +    cc.sql("""
    +           delete FROM t3 where salary > 15005
    --- End diff --
   
    Please use capital letters


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/540#discussion_r96592006
 
    --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/DataUpdateDeleteExample.scala ---
    @@ -0,0 +1,81 @@
    +/*
    + * 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.carbondata.examples
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.examples.util.ExampleUtils
    +
    +object DataUpdateDeleteExample {
    +
    +  def main(args: Array[String]) {
    +    val cc = ExampleUtils.createCarbonContext("DataUpdateDeleteExample")
    +    val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv"
    +
    +    // Specify timestamp format based on raw data
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
    +
    +    cc.sql("DROP TABLE IF EXISTS t3")
    +
    +    // Create table, 6 dimensions, 1 measure
    +    cc.sql("""
    +           CREATE TABLE IF NOT EXISTS t3
    +           (ID Int, date Timestamp, country String,
    +           name String, phonetype String, serialname char(10), salary Int)
    +           STORED BY 'carbondata'
    +           """)
    +
    +    cc.sql(s"""
    +           LOAD DATA LOCAL INPATH '$testData' into table t3
    +           """)
    +
    +    // Query data before update and deletion
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Delete data where salary > 15005
    +    cc.sql("""
    +           delete FROM t3 where salary > 15005
    --- End diff --
   
    Please use capital letters


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/540#discussion_r96593534
 
    --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/DataUpdateDeleteExample.scala ---
    @@ -0,0 +1,81 @@
    +/*
    + * 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.carbondata.examples
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.examples.util.ExampleUtils
    +
    +object DataUpdateDeleteExample {
    +
    +  def main(args: Array[String]) {
    +    val cc = ExampleUtils.createCarbonContext("DataUpdateDeleteExample")
    +    val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv"
    +
    +    // Specify timestamp format based on raw data
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
    +
    +    cc.sql("DROP TABLE IF EXISTS t3")
    +
    +    // Create table, 6 dimensions, 1 measure
    +    cc.sql("""
    +           CREATE TABLE IF NOT EXISTS t3
    +           (ID Int, date Timestamp, country String,
    +           name String, phonetype String, serialname char(10), salary Int)
    +           STORED BY 'carbondata'
    +           """)
    +
    +    cc.sql(s"""
    +           LOAD DATA LOCAL INPATH '$testData' into table t3
    +           """)
    +
    +    // Query data before update and deletion
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Delete data where salary > 15005
    +    cc.sql("""
    +           delete FROM t3 where salary > 15005
    +           """).show()
    +
    +    // Query data again after delete data where salary > 15005
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Update data where salary < 15003
    +    cc.sql("""
    +           update t3 set (t3.country) = ('india') where t3.salary < 15003
    --- End diff --
   
    can you add a more complex update statement, like using JOIN and subquery?


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/540#discussion_r96595675
 
    --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/DataUpdateDeleteExample.scala ---
    @@ -0,0 +1,81 @@
    +/*
    + * 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.carbondata.examples
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.examples.util.ExampleUtils
    +
    +object DataUpdateDeleteExample {
    +
    +  def main(args: Array[String]) {
    +    val cc = ExampleUtils.createCarbonContext("DataUpdateDeleteExample")
    +    val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv"
    +
    +    // Specify timestamp format based on raw data
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
    +
    +    cc.sql("DROP TABLE IF EXISTS t3")
    +
    +    // Create table, 6 dimensions, 1 measure
    +    cc.sql("""
    +           CREATE TABLE IF NOT EXISTS t3
    +           (ID Int, date Timestamp, country String,
    +           name String, phonetype String, serialname char(10), salary Int)
    +           STORED BY 'carbondata'
    +           """)
    +
    +    cc.sql(s"""
    +           LOAD DATA LOCAL INPATH '$testData' into table t3
    +           """)
    +
    +    // Query data before update and deletion
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Delete data where salary > 15005
    +    cc.sql("""
    +           delete FROM t3 where salary > 15005
    +           """).show()
    +
    +    // Query data again after delete data where salary > 15005
    +    cc.sql("""
    +           SELECT * FROM t3
    +           """).show()
    +
    +    // Update data where salary < 15003
    +    cc.sql("""
    +           update t3 set (t3.country) = ('india') where t3.salary < 15003
    --- End diff --
   
    ok


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [CARBONDATA-654] Add data update and deleti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/654/



---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [CARBONDATA-654] Add data update and deleti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    Build Failed  with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/658/



---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [CARBONDATA-654] Add data update and deleti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    Build Failed  with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/662/



---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [CARBONDATA-654] Add data update and deleti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/665/



---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #540: [CARBONDATA-654] Add data update and deleti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/540
 
    LGTM


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #540: [CARBONDATA-654] Add data update and...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/540


---
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.
---