You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/21 09:33:33 UTC

[GitHub] [flink-table-store] JingsongLi opened a new pull request, #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

JingsongLi opened a new pull request, #98:
URL: https://github.com/apache/flink-table-store/pull/98

   PartialUpdateMergeFunction, It will merge two records, completing the not-null fields.
   It is very useful for wide tables, where two source tables join together to form a wide table.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-table-store] LadyForest commented on a diff in pull request #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

Posted by GitBox <gi...@apache.org>.
LadyForest commented on code in PR #98:
URL: https://github.com/apache/flink-table-store/pull/98#discussion_r855008375


##########
docs/content/docs/development/create-table.md:
##########
@@ -233,3 +233,37 @@ The two methods do not behave in the same way when querying.
 Use approach one if you have a large number of filtered queries
 with only `user_id`, and use approach two if you have a large
 number of filtered queries with only `catalog_id`.
+
+## Partial Update
+
+You can configure partial update from options:
+
+```sql
+CREATE TABLE MyTable (
+  product_id BIGINT,
+  price DOUBLE,
+  number BIGINT,
+  detail STRING,
+  PRIMARY KEY (product_id) NOT ENFORCED
+) WITH (
+  'merge-engine' = 'partial-update'
+);
+```
+
+{{< hint info >}}
+__Note:__ Partial update is only supported for table with primary key.
+{{< /hint >}}
+
+{{< hint info >}}
+__Note:__ Partial update is not supported for streaming consuming.
+{{< /hint >}}
+
+The value fields are updated to the latest data one by one
+under the same primary key, but null values are not overwritten.
+
+For example, the inputs: 
+- 1, 23.0, 10,   NULL
+- 1, NULL, 20,   'This is a book'
+- 1, 25.2, NULL, NULL
+
+Output: <1, 25.2, 20, 'This is a book'>

Review Comment:
   Nit: keep format consistent
   
   For example, the inputs:  
   - `<1, 23.0, 10, NULL>`
   - `<1, NULL, 20, 'This is a book'>`
   - `<1, 25.2, NULL, NULL>`
   
   Output:  
   - `<1, 25.2, 20, 'This is a book'>`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-table-store] LadyForest commented on a diff in pull request #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

Posted by GitBox <gi...@apache.org>.
LadyForest commented on code in PR #98:
URL: https://github.com/apache/flink-table-store/pull/98#discussion_r855015578


##########
docs/content/docs/development/create-table.md:
##########
@@ -233,3 +233,37 @@ The two methods do not behave in the same way when querying.
 Use approach one if you have a large number of filtered queries
 with only `user_id`, and use approach two if you have a large
 number of filtered queries with only `catalog_id`.
+
+## Partial Update
+
+You can configure partial update from options:
+
+```sql
+CREATE TABLE MyTable (
+  product_id BIGINT,
+  price DOUBLE,
+  number BIGINT,
+  detail STRING,
+  PRIMARY KEY (product_id) NOT ENFORCED
+) WITH (
+  'merge-engine' = 'partial-update'
+);
+```
+
+{{< hint info >}}
+__Note:__ Partial update is only supported for table with primary key.
+{{< /hint >}}
+
+{{< hint info >}}
+__Note:__ Partial update is not supported for streaming consuming.

Review Comment:
   Nit: not supported under streaming mode?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-table-store] JingsongLi commented on a diff in pull request #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

Posted by GitBox <gi...@apache.org>.
JingsongLi commented on code in PR #98:
URL: https://github.com/apache/flink-table-store/pull/98#discussion_r855104891


##########
docs/content/docs/development/create-table.md:
##########
@@ -233,3 +233,37 @@ The two methods do not behave in the same way when querying.
 Use approach one if you have a large number of filtered queries
 with only `user_id`, and use approach two if you have a large
 number of filtered queries with only `catalog_id`.
+
+## Partial Update
+
+You can configure partial update from options:
+
+```sql
+CREATE TABLE MyTable (
+  product_id BIGINT,
+  price DOUBLE,
+  number BIGINT,
+  detail STRING,
+  PRIMARY KEY (product_id) NOT ENFORCED
+) WITH (
+  'merge-engine' = 'partial-update'
+);
+```
+
+{{< hint info >}}
+__Note:__ Partial update is only supported for table with primary key.
+{{< /hint >}}
+
+{{< hint info >}}
+__Note:__ Partial update is not supported for streaming consuming.

Review Comment:
   No, just streaming consuming.
   User can insert into it under streaming mode.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-table-store] JingsongLi merged pull request #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

Posted by GitBox <gi...@apache.org>.
JingsongLi merged PR #98:
URL: https://github.com/apache/flink-table-store/pull/98


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-table-store] LadyForest commented on a diff in pull request #98: [FLINK-26457] Introduce PartialUpdateMergeFunction

Posted by GitBox <gi...@apache.org>.
LadyForest commented on code in PR #98:
URL: https://github.com/apache/flink-table-store/pull/98#discussion_r855012520


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/mergetree/compact/PartialUpdateMergeFunction.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.flink.table.store.file.mergetree.compact;
+
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+
+import javax.annotation.Nullable;
+
+/**
+ * A {@link MergeFunction} where key is primary key (unique) and value is the partial record, update
+ * non-null fields on merge.
+ */
+public class PartialUpdateMergeFunction implements MergeFunction {
+
+    private final RowData.FieldGetter[] getters;
+
+    public PartialUpdateMergeFunction(RowData.FieldGetter[] getters) {
+        this.getters = getters;
+    }
+
+    private transient GenericRowData row;

Review Comment:
   Nit: keep member variables together?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org