You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "sullis (via GitHub)" <gi...@apache.org> on 2024/07/22 21:26:10 UTC
[PR] wip: support for deleting segments using sql [pinot]
sullis opened a new pull request, #13678:
URL: https://github.com/apache/pinot/pull/13678
**This PR is a work in progress.**
# Motivation
This PR was motivated by a GitHub issue:
https://github.com/apache/pinot/issues/13476
# Modifications
- add class: DeleteSegmentStatement
- new logic in CalciteSqlParser
- new logic DataManipulationStatementParser
# About the DeleteSegmentStatement class
DeleteSegmentStatement implements Pinot's DataManipulationStatement interface.
This class uses ExecutionType.MINION
# Feedback requested:
- is ExecutionType.MINION the correct choice for DeleteSegmentStatement? The only other choice is ExceptionType.HTTP. I reviewed the source tree and I could not find any Pinot statements that use ExceptionType.HTTP
- What is the correct way to delete segments? I have not worked with segments before and I could use some guidance.
- Based on my current understanding, it looks like I need to add behavior to the "executeTask" method in SegmentDeletionTaskExecutor.java. I left a "TODO" comment in this file to indicate that the implementation is incomplete
# Testing
- added DeleteSegmentStatementTest.java
- added DataManipulationStatementParserTest.java
- added SegmentDeletionMinionClusterIntegrationTest.java
# Supporting document
This Google Doc has additional information about Pinot SQL endpoints and segment deletion:
https://docs.google.com/document/d/1bsg3QKeZiXiFh2__tDkor-v0eDw0QBKuPZiK3DWg_04/edit?usp=sharing
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #13678:
URL: https://github.com/apache/pinot/pull/13678#discussion_r1699016040
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/dml/DeleteSegmentStatement.java:
##########
@@ -0,0 +1,116 @@
+/**
+ * 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.pinot.sql.parsers.dml;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.calcite.sql.SqlBasicCall;
+import org.apache.calcite.sql.SqlDelete;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.spi.config.task.AdhocTaskConfig;
+import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DeleteSegmentStatement implements DataManipulationStatement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSegmentStatement.class);
+ private static final DataSchema DELETE_FROM_RESPONSE_SCHEMA =
+ new DataSchema(new String[]{"tableName", "taskJobName"},
+ new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.STRING});
+ private static final Set<String> VALID_OPERATORS = Set.of("LIKE", "=");
+ private static final String TASK_NAME = "taskName";
+ private static final String TASK_TYPE = "taskType";
+ private static final String DEFAULT_TASK_TYPE = "SegmentDeletionTask";
+ private static final String SEGMENT_NAME = "segmentName";
+ private static final String OPERATOR = "operator";
+
+ private final String _table;
+ private final Map<String, String> _queryOptions;
+
+ public DeleteSegmentStatement(String table, Map<String, String> queryOptions) {
+ _table = table;
+ _queryOptions = queryOptions;
+ }
+
+ public String getTable() {
+ return _table;
+ }
+
+ public Map<String, String> getQueryOptions() {
+ return _queryOptions;
+ }
+
+ public static DeleteSegmentStatement parse(SqlNodeAndOptions sqlNodeAndOptions) {
+ SqlNode sqlNode = sqlNodeAndOptions.getSqlNode();
+ assert sqlNode instanceof SqlDelete;
+ SqlDelete sqlDelete = (SqlDelete) sqlNode;
+ String tableName = sqlDelete.getTargetTable().toString();
+ SqlBasicCall condition = (SqlBasicCall) sqlDelete.getCondition();
+ if (condition == null) {
+ throw new IllegalStateException("missing WHERE clause");
+ }
+ List<SqlNode> operandList = condition.getOperandList();
+ if (operandList.size() != 2) {
+ throw new IllegalStateException("expected 2 operands. Found: " + operandList.size());
+ }
+
+ String operator = (condition.getOperator() == null) ? null : condition.getOperator().toString().toUpperCase();
+
+ if (!VALID_OPERATORS.contains(operator)) {
+ throw new IllegalStateException("unsupported operator: " + operator);
+ }
+
+ Map<String, String> optionsMap = sqlNodeAndOptions.getOptions();
+ optionsMap.put(OPERATOR, operator);
+
+ if (operandList.get(0).toString().equals("$segmentName")) {
+ optionsMap.put(SEGMENT_NAME, operandList.get(1).toString());
+ } else {
+ throw new IllegalStateException("missing $segmentName in WHERE clause");
+ }
+
+ return new DeleteSegmentStatement(tableName, optionsMap);
+ }
+
+ @Override
+ public ExecutionType getExecutionType() {
+ return ExecutionType.MINION;
Review Comment:
Suggest to use HTTP to make the segment deletion requests synchronized.
Though underlying deleting segments from servers is still async
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #13678:
URL: https://github.com/apache/pinot/pull/13678#discussion_r1699176388
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/dml/DeleteSegmentStatement.java:
##########
@@ -0,0 +1,116 @@
+/**
+ * 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.pinot.sql.parsers.dml;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.calcite.sql.SqlBasicCall;
+import org.apache.calcite.sql.SqlDelete;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.spi.config.task.AdhocTaskConfig;
+import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DeleteSegmentStatement implements DataManipulationStatement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSegmentStatement.class);
+ private static final DataSchema DELETE_FROM_RESPONSE_SCHEMA =
+ new DataSchema(new String[]{"tableName", "taskJobName"},
+ new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.STRING});
+ private static final Set<String> VALID_OPERATORS = Set.of("LIKE", "=");
+ private static final String TASK_NAME = "taskName";
+ private static final String TASK_TYPE = "taskType";
+ private static final String DEFAULT_TASK_TYPE = "SegmentDeletionTask";
+ private static final String SEGMENT_NAME = "segmentName";
+ private static final String OPERATOR = "operator";
+
+ private final String _table;
+ private final Map<String, String> _queryOptions;
+
+ public DeleteSegmentStatement(String table, Map<String, String> queryOptions) {
Review Comment:
Say if later on I want to extend the usage to:
1. leverage segment metadata or other criteria for segment selection, e.g. I may want to delete all the segments with a time range [d1, d2] or segments with partition.id = 10
2. query matched segments using pinot query is the predicate is a real query, e.g.
`DELETE FROM myTable WHERE uuid='xxx'` , which means you can send a query: `SELECT distinct $segmentName FROM myTable WHERE uuid='xxx'` to pinot first to get all the segment list then drop them accordingly.
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #13678:
URL: https://github.com/apache/pinot/pull/13678#issuecomment-2243910235
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/13678?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `0%` with `104 lines` in your changes missing coverage. Please review.
> Project coverage is 0.00%. Comparing base [(`59551e4`)](https://app.codecov.io/gh/apache/pinot/commit/59551e45224f1535c4863fd577622b37366ccc97?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`54de3a7`)](https://app.codecov.io/gh/apache/pinot/commit/54de3a78af71176c087e685c0e55c460a4f4c8c5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 795 commits behind head on master.
| [Files](https://app.codecov.io/gh/apache/pinot/pull/13678?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [.../pinot/sql/parsers/dml/DeleteSegmentStatement.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsql%2Fparsers%2Fdml%2FDeleteSegmentStatement.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcWwvcGFyc2Vycy9kbWwvRGVsZXRlU2VnbWVudFN0YXRlbWVudC5qYXZh) | 0.00% | [35 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...s/segmentdeletion/SegmentDeletionTaskExecutor.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-plugins%2Fpinot-minion-tasks%2Fpinot-minion-builtin-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fplugin%2Fminion%2Ftasks%2Fsegmentdeletion%2FSegmentDeletionTaskExecutor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3Mvc2VnbWVudGRlbGV0aW9uL1NlZ21lbnREZWxldGlvblRhc2tFeGVjdXRvci5qYXZh) | 0.00% | [23 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...n/tasks/segmentdeletion/SegmentDeletionResult.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-plugins%2Fpinot-minion-tasks%2Fpinot-minion-builtin-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fplugin%2Fminion%2Ftasks%2Fsegmentdeletion%2FSegmentDeletionResult.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3Mvc2VnbWVudGRlbGV0aW9uL1NlZ21lbnREZWxldGlvblJlc3VsdC5qYXZh) | 0.00% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [.../segmentdeletion/SegmentDeletionTaskGenerator.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-plugins%2Fpinot-minion-tasks%2Fpinot-minion-builtin-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fplugin%2Fminion%2Ftasks%2Fsegmentdeletion%2FSegmentDeletionTaskGenerator.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3Mvc2VnbWVudGRlbGV0aW9uL1NlZ21lbnREZWxldGlvblRhc2tHZW5lcmF0b3IuamF2YQ==) | 0.00% | [9 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ntdeletion/SegmentDeletionTaskExecutorFactory.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-plugins%2Fpinot-minion-tasks%2Fpinot-minion-builtin-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fplugin%2Fminion%2Ftasks%2Fsegmentdeletion%2FSegmentDeletionTaskExecutorFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3Mvc2VnbWVudGRlbGV0aW9uL1NlZ21lbnREZWxldGlvblRhc2tFeGVjdXRvckZhY3RvcnkuamF2YQ==) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...org/apache/pinot/sql/parsers/CalciteSqlParser.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsql%2Fparsers%2FCalciteSqlParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcWwvcGFyc2Vycy9DYWxjaXRlU3FsUGFyc2VyLmphdmE=) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...l/parsers/dml/DataManipulationStatementParser.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsql%2Fparsers%2Fdml%2FDataManipulationStatementParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcWwvcGFyc2Vycy9kbWwvRGF0YU1hbmlwdWxhdGlvblN0YXRlbWVudFBhcnNlci5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...on/SegmentDeletionTaskProgressObserverFactory.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-plugins%2Fpinot-minion-tasks%2Fpinot-minion-builtin-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fplugin%2Fminion%2Ftasks%2Fsegmentdeletion%2FSegmentDeletionTaskProgressObserverFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3Mvc2VnbWVudGRlbGV0aW9uL1NlZ21lbnREZWxldGlvblRhc2tQcm9ncmVzc09ic2VydmVyRmFjdG9yeS5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [.../org/apache/pinot/core/common/MinionConstants.java](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&filepath=pinot-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fcore%2Fcommon%2FMinionConstants.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9jb21tb24vTWluaW9uQ29uc3RhbnRzLmphdmE=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/13678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (59551e4) and HEAD (54de3a7). Click for more details.
>
> <details><summary>HEAD has 40 uploads less than BASE</summary>
>
>| Flag | BASE (59551e4) | HEAD (54de3a7) |
>|------|------|------|
>|integration|7|4|
>|integration2|3|0|
>|temurin|12|4|
>|java-21|7|3|
>|skip-bytebuffers-true|3|1|
>|skip-bytebuffers-false|7|2|
>|unittests|5|0|
>|unittests1|2|0|
>|java-11|5|1|
>|unittests2|3|0|
>|custom-integration1|2|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #13678 +/- ##
=============================================
- Coverage 61.75% 0.00% -61.75%
+ Complexity 207 6 -201
=============================================
Files 2436 2485 +49
Lines 133233 136995 +3762
Branches 20636 21325 +689
=============================================
- Hits 82274 6 -82268
- Misses 44911 136989 +92078
+ Partials 6048 0 -6048
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-0.01%)` | :arrow_down: |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-0.01%)` | :arrow_down: |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-0.01%)` | :arrow_down: |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-11](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-61.71%)` | :arrow_down: |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-61.63%)` | :arrow_down: |
| [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-61.75%)` | :arrow_down: |
| [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-27.73%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (-61.75%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/13678/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/13678?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #13678:
URL: https://github.com/apache/pinot/pull/13678#discussion_r1699176388
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/dml/DeleteSegmentStatement.java:
##########
@@ -0,0 +1,116 @@
+/**
+ * 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.pinot.sql.parsers.dml;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.calcite.sql.SqlBasicCall;
+import org.apache.calcite.sql.SqlDelete;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.spi.config.task.AdhocTaskConfig;
+import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DeleteSegmentStatement implements DataManipulationStatement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSegmentStatement.class);
+ private static final DataSchema DELETE_FROM_RESPONSE_SCHEMA =
+ new DataSchema(new String[]{"tableName", "taskJobName"},
+ new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.STRING});
+ private static final Set<String> VALID_OPERATORS = Set.of("LIKE", "=");
+ private static final String TASK_NAME = "taskName";
+ private static final String TASK_TYPE = "taskType";
+ private static final String DEFAULT_TASK_TYPE = "SegmentDeletionTask";
+ private static final String SEGMENT_NAME = "segmentName";
+ private static final String OPERATOR = "operator";
+
+ private final String _table;
+ private final Map<String, String> _queryOptions;
+
+ public DeleteSegmentStatement(String table, Map<String, String> queryOptions) {
Review Comment:
Say if later on I want to extend the usage to:
1. leverage segment metadata or other criteria for segment selection, e.g. I may want to delete all the segments with a time range [d1, d2] or segments with partition.id = 10
2. query matched segments using pinot query is the predicate is a real query, e.g.
`DELETE FROM myTable WHERE uuid='xxx'` , which means you can send a query: `SELECT distinct $segmentName FROM myTable WHERE uuid='xxx'` to pinot first to get all the segment list then drop them accordingly.
I feel if we can separate this to just table and a list of segments to delete, and before this, we can have different implementations for a SelectSelector interface.
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on PR #13678:
URL: https://github.com/apache/pinot/pull/13678#issuecomment-2261179465
Overall I'm good with the parser part.
Regarding the implementation for deletion, I feel it's ok to let controller handle it directly, since this is not a heavy or time consuming operation.
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "sullis (via GitHub)" <gi...@apache.org>.
sullis commented on PR #13678:
URL: https://github.com/apache/pinot/pull/13678#issuecomment-2243843860
This PR is a work in progress.
Feedback requested cc: @npawar @Jackie-Jiang
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] wip: support for deleting segments using sql [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #13678:
URL: https://github.com/apache/pinot/pull/13678#discussion_r1699176388
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/dml/DeleteSegmentStatement.java:
##########
@@ -0,0 +1,116 @@
+/**
+ * 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.pinot.sql.parsers.dml;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.calcite.sql.SqlBasicCall;
+import org.apache.calcite.sql.SqlDelete;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.spi.config.task.AdhocTaskConfig;
+import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DeleteSegmentStatement implements DataManipulationStatement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSegmentStatement.class);
+ private static final DataSchema DELETE_FROM_RESPONSE_SCHEMA =
+ new DataSchema(new String[]{"tableName", "taskJobName"},
+ new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.STRING});
+ private static final Set<String> VALID_OPERATORS = Set.of("LIKE", "=");
+ private static final String TASK_NAME = "taskName";
+ private static final String TASK_TYPE = "taskType";
+ private static final String DEFAULT_TASK_TYPE = "SegmentDeletionTask";
+ private static final String SEGMENT_NAME = "segmentName";
+ private static final String OPERATOR = "operator";
+
+ private final String _table;
+ private final Map<String, String> _queryOptions;
+
+ public DeleteSegmentStatement(String table, Map<String, String> queryOptions) {
Review Comment:
Say if later on I want to extend the usage to:
1. leverage segment metadata or other criteria for segment selection, e.g. I may want to delete all the segments with a time range [d1, d2] or segments with partition.id = 10
2. query matched segments using pinot query is the predicate is a real query, e.g.
`DELETE FROM myTable WHERE uuid='xxx'` , which means you can send a query: `SELECT distinct $segmentName FROM myTable WHERE uuid='xxx'` to pinot first to get all the segment list then drop them accordingly.
I feel if we can separate this to just table and a list of segments to delete, and before this, we can have different implementations for a SegmentSelector interface, e.g. `NameBasedSegmentSelector`, `MetadataBasedSegmentSelector`, `QueryBasedSegmentSelector`.
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org