317brian commented on code in PR #14781:
URL: https://github.com/apache/druid/pull/14781#discussion_r1295197737
##########
examples/quickstart/jupyter-notebooks/notebooks/04-api/01-delete-api-tutorial.ipynb:
##########
@@ -621,117 +621,126 @@
},
{
"cell_type": "markdown",
- "id": "f0d0578c",
+ "id": "8b2d59c8",
"metadata": {},
"source": [
- "## Delete entire table"
+ "## Delete by segment ID"
]
},
{
"cell_type": "markdown",
- "id": "b8d0260a",
+ "id": "a4e8453e",
"metadata": {},
"source": [
- "You can delete entire tables the same way you can delete segments of a
table, using intervals.\n",
- "\n",
- "Run the following cell to reset the endpoint to
`/druid/coordinator/v1/datasources/:dataSource/markUnused`."
+ "In addition to deleting by interval, you can delete segments by using
`segment_id`. Run the next cell to retrieve the `segment_id` of each segment."
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "dd354886",
+ "id": "7f4e4ed7",
"metadata": {},
"outputs": [],
"source": [
- "endpoint = druid_host +
'/druid/coordinator/v1/datasources/wikipedia_hour/markUnused'\n",
- "endpoint"
+ "endpoint = druid_host + '/druid/v2/sql'\n",
+ "sql_request = {\n",
+ " \"query\": \"SELECT segment_id FROM sys.segments WHERE
\\\"datasource\\\" = 'wikipedia_hour'\",\n",
+ " \"resultFormat\": \"objectLines\"\n",
+ "}\n",
+ "\n",
+ "response = session.post(endpoint, json=sql_request)\n",
+ "print(response.text)"
]
},
{
"cell_type": "markdown",
- "id": "ed3cf7d3",
+ "id": "017d63e9",
"metadata": {},
"source": [
- "Next, send a `POST` with the payload `{\"interval\":
\"2015-09-12T00:00:00.000Z/2015-09-13T01:00:00.000Z\"}` to mark the entirety of
the table as \"unused.\""
+ "With known `segment_id`, you can mark specific segments \"unused\" by
sending a request to the
`/druid/coordinator/v1/datasources/wikipedia_hour/markUnused` endpoint with an
array of `segment_id` values."
Review Comment:
```suggestion
"If you know the `segment_id`, you can mark specific segments \"unused\"
by sending a request to the
`/druid/coordinator/v1/datasources/wikipedia_hour/markUnused` endpoint with an
array of `segment_id` values."
```
##########
examples/quickstart/jupyter-notebooks/notebooks/04-api/01-delete-api-tutorial.ipynb:
##########
@@ -621,117 +621,126 @@
},
{
"cell_type": "markdown",
- "id": "f0d0578c",
+ "id": "8b2d59c8",
"metadata": {},
"source": [
- "## Delete entire table"
+ "## Delete by segment ID"
]
},
{
"cell_type": "markdown",
- "id": "b8d0260a",
+ "id": "a4e8453e",
"metadata": {},
"source": [
- "You can delete entire tables the same way you can delete segments of a
table, using intervals.\n",
- "\n",
- "Run the following cell to reset the endpoint to
`/druid/coordinator/v1/datasources/:dataSource/markUnused`."
+ "In addition to deleting by interval, you can delete segments by using
`segment_id`. Run the next cell to retrieve the `segment_id` of each segment."
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "dd354886",
+ "id": "7f4e4ed7",
"metadata": {},
"outputs": [],
"source": [
- "endpoint = druid_host +
'/druid/coordinator/v1/datasources/wikipedia_hour/markUnused'\n",
- "endpoint"
+ "endpoint = druid_host + '/druid/v2/sql'\n",
+ "sql_request = {\n",
+ " \"query\": \"SELECT segment_id FROM sys.segments WHERE
\\\"datasource\\\" = 'wikipedia_hour'\",\n",
+ " \"resultFormat\": \"objectLines\"\n",
+ "}\n",
+ "\n",
+ "response = session.post(endpoint, json=sql_request)\n",
+ "print(response.text)"
]
},
{
"cell_type": "markdown",
- "id": "ed3cf7d3",
+ "id": "017d63e9",
"metadata": {},
"source": [
- "Next, send a `POST` with the payload `{\"interval\":
\"2015-09-12T00:00:00.000Z/2015-09-13T01:00:00.000Z\"}` to mark the entirety of
the table as \"unused.\""
+ "With known `segment_id`, you can mark specific segments \"unused\" by
sending a request to the
`/druid/coordinator/v1/datasources/wikipedia_hour/markUnused` endpoint with an
array of `segment_id` values."
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "25639752",
+ "id": "e320037a",
"metadata": {},
"outputs": [],
"source": [
- "sql_request = {\n",
- " \"interval\": \"2015-09-12T00:00:00.000Z/2015-09-13T01:00:00.000Z\"\n",
- "}\n",
- "\n",
- "response = session.post(endpoint, json=sql_request);\n",
- "\n",
- "response.status_code"
+ "endpoint = druid_host +
'/druid/coordinator/v1/datasources/wikipedia_hour/markUnused'\n",
+ "endpoint"
]
},
{
"cell_type": "markdown",
- "id": "bbbba823",
+ "id": "16861873",
"metadata": {},
"source": [
- "To verify the segment changes, the following cell sets the endpoint to
`/druid/v2/sql` and sends a SQL-based request. "
+ "In the next cell, construct a payload with `segmentIds` property and an
array of `segment_id`. This payload should send the segments responsible for
the interval `01:00:00.000` to `02:00:00.000` and `5:00:00.000` to
`6:00:00.000` to be marked as \"unused.\"\n",
Review Comment:
This wording can make it sound like we're sending the actual segments/data,
but you're sending the IDs that correspond to the segments you want to delete
##########
examples/quickstart/jupyter-notebooks/notebooks/04-api/01-delete-api-tutorial.ipynb:
##########
@@ -951,14 +888,22 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "f5f31f08",
+ "id": "98834167",
"metadata": {},
"outputs": [],
"source": [
- "response = session.delete(endpoint)\n",
+ "response = session.delete(endpoint);\n",
"response.status_code"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "55745cb5-2869-4086-a247-62d78956c8b4",
+ "metadata": {},
+ "source": [
+ "If you inspect your deep storage again, the directory for the datasource
would be removed along with its corresponding segments."
Review Comment:
Generally, avoid `would`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]