You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2024/01/18 12:46:55 UTC
[PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
JingsongLi opened a new pull request, #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "TaoZex (via GitHub)" <gi...@apache.org>.
TaoZex commented on code in PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738#discussion_r1457713385
##########
docs/content/engines/spark.md:
##########
@@ -549,23 +549,33 @@ Here list the configurations.
## Spark Procedure
This section introduce all available spark procedures about paimon.
-
+s
<table class="table table-bordered">
<thead>
<tr>
<th class="text-left" style="width: 4%">Procedure Name</th>
- <th class="text-left" style="width: 4%">Usage</th>
<th class="text-left" style="width: 20%">Explaination</th>
<th class="text-left" style="width: 4%">Example</th>
</tr>
</thead>
<tbody style="font-size: 12px; ">
<tr>
<td>compact</td>
- <td><nobr>CALL [paimon.]sys.compact(table => '<identifier>' [,partitions => '<partitions>'] </nobr><br>[, order_strategy =>'<sort_type>'] [,order_by => '<columns>'])</td>
<td>identifier: the target table identifier. Cannot be empty.<br><br><nobr>partitions: partition filter. Left empty for all partitions.<br> "," means "AND"<br>";" means "OR"</nobr><br><br>order_strategy: 'order' or 'zorder' or 'hilbert' or 'none'. Left empty for 'none'. <br><br><nobr>order_columns: the columns need to be sort. Left empty if 'order_strategy' is 'none'. </nobr><br><br>If you want sort compact two partitions date=01 and date=02, you need to write 'date=01;date=02'<br><br>If you want sort one partition with date=01 and day=01, you need to write 'date=01,day=01'</td>
<td><nobr>SET spark.sql.shuffle.partitions=10; --set the compact parallelism</nobr><br><nobr>CALL sys.compact(table => 'T', partitions => 'p=0', order_strategy => 'zorder', order_by => 'a,b')</nobr></td>
</tr>
+ <tr>
+ <td>expire_snapshots</td>
+ <td>
+ To expire snapshots. Argument:
+ <li>table: the target table identifier. Cannot be empty.</li>
+ <li>retainMax: the maximum number of completed snapshots to retain.</li>
+ <li>retainMin: the min number of completed snapshots to retain.</li>
Review Comment:
```suggestion
<li>retainMin: the minimum number of completed snapshots to retain.</li>
```
##########
docs/content/engines/flink.md:
##########
@@ -502,5 +502,18 @@ table options syntax: we use string to represent table options. The format is 'k
</td>
<td>CALL sys.rollback_to('default.T', 10)</td>
</tr>
+ <tr>
+ <td>expire_snapshots</td>
+ <td>
+ -- expires snapshot<br/>
+ CALL sys.expire_snapshots('identifier', retainMax)<br/><br/>
+ </td>
+ <td>
+ To expire snapshots. Argument:
+ <li>identifier: the target table identifier. Cannot be empty.</li>
+ <li>retainMax: the maximum number of completed snapshots to retain.</li>
Review Comment:
Lack of retainMin, older_than, max_deletes three parameters.
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/procedure/ExpireSnapshotsProcedure.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.paimon.flink.procedure;
+
+import org.apache.paimon.catalog.Catalog;
+
+import org.apache.flink.table.procedure.ProcedureContext;
+
+/** A procedure to expire snapshots. */
+public class ExpireSnapshotsProcedure extends ProcedureBase {
+
+ @Override
+ public String identifier() {
+ return "expire_snapshots";
+ }
+
+ public String[] call(ProcedureContext procedureContext, String tableId, int retainMax)
+ throws Catalog.TableNotExistException {
+ return new String[] {
+ table(tableId).newExpireSnapshots().retainMax(retainMax).expire() + ""
Review Comment:
How about use new String?
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738#discussion_r1458217864
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/procedure/ExpireSnapshotsProcedure.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.paimon.flink.procedure;
+
+import org.apache.paimon.catalog.Catalog;
+
+import org.apache.flink.table.procedure.ProcedureContext;
+
+/** A procedure to expire snapshots. */
+public class ExpireSnapshotsProcedure extends ProcedureBase {
+
+ @Override
+ public String identifier() {
+ return "expire_snapshots";
+ }
+
+ public String[] call(ProcedureContext procedureContext, String tableId, int retainMax)
+ throws Catalog.TableNotExistException {
+ return new String[] {
+ table(tableId).newExpireSnapshots().retainMax(retainMax).expire() + ""
Review Comment:
`String.valueOf`? Seems same to me.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738#discussion_r1458216571
##########
docs/content/engines/flink.md:
##########
@@ -502,5 +502,18 @@ table options syntax: we use string to represent table options. The format is 'k
</td>
<td>CALL sys.rollback_to('default.T', 10)</td>
</tr>
+ <tr>
+ <td>expire_snapshots</td>
+ <td>
+ -- expires snapshot<br/>
+ CALL sys.expire_snapshots('identifier', retainMax)<br/><br/>
+ </td>
+ <td>
+ To expire snapshots. Argument:
+ <li>identifier: the target table identifier. Cannot be empty.</li>
+ <li>retainMax: the maximum number of completed snapshots to retain.</li>
Review Comment:
Now, Flink SQL dose not have named arguement, so here, we just provide retainMax only. The simplest one.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738#discussion_r1458216571
##########
docs/content/engines/flink.md:
##########
@@ -502,5 +502,18 @@ table options syntax: we use string to represent table options. The format is 'k
</td>
<td>CALL sys.rollback_to('default.T', 10)</td>
</tr>
+ <tr>
+ <td>expire_snapshots</td>
+ <td>
+ -- expires snapshot<br/>
+ CALL sys.expire_snapshots('identifier', retainMax)<br/><br/>
+ </td>
+ <td>
+ To expire snapshots. Argument:
+ <li>identifier: the target table identifier. Cannot be empty.</li>
+ <li>retainMax: the maximum number of completed snapshots to retain.</li>
Review Comment:
Now, Flink SQL dose not have named arguement, so here, we just provide retainMax only.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Introduce expire_snapshots procedure [incubator-paimon]
Posted by "TaoZex (via GitHub)" <gi...@apache.org>.
TaoZex commented on code in PR #2738:
URL: https://github.com/apache/incubator-paimon/pull/2738#discussion_r1458387702
##########
docs/content/engines/flink.md:
##########
@@ -502,5 +502,18 @@ table options syntax: we use string to represent table options. The format is 'k
</td>
<td>CALL sys.rollback_to('default.T', 10)</td>
</tr>
+ <tr>
+ <td>expire_snapshots</td>
+ <td>
+ -- expires snapshot<br/>
+ CALL sys.expire_snapshots('identifier', retainMax)<br/><br/>
+ </td>
+ <td>
+ To expire snapshots. Argument:
+ <li>identifier: the target table identifier. Cannot be empty.</li>
+ <li>retainMax: the maximum number of completed snapshots to retain.</li>
Review Comment:
Thanks for your reply. I understand it.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org