Skip to content

Commit

Permalink
DumpSegment tool. (apache#3182)
Browse files Browse the repository at this point in the history
  • Loading branch information
gianm authored and fjy committed Jun 23, 2016
1 parent a437fb1 commit da660bb
Show file tree
Hide file tree
Showing 4 changed files with 546 additions and 1 deletion.
62 changes: 62 additions & 0 deletions docs/content/operations/dump-segment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
layout: doc_page
---
# DumpSegment tool

The DumpSegment tool can be used to dump the metadata or contents of a segment for debugging purposes. Note that the
dump is not necessarily a full-fidelity translation of the segment. In particular, not all metadata is included, indexes
are not included, and complex metric values may not be complete.

To run the tool, point it at a segment directory and provide a file for writing output:

```
java io.druid.cli.Main tools dump-segment \
--directory /home/druid/path/to/segment/ \
--out /home/druid/output.txt
```

### Output format

Data dumps generated by this tool are newline-separate JSON objects, with one object per line. For example, one line
might look like this when pretty-printed:

```
{
"__time": 1442018818771,
"added": 36,
"channel": "#en.wikipedia",
"cityName": null,
"comment": "added project",
"count": 1,
"countryIsoCode": null,
"countryName": null,
"deleted": 0,
"delta": 36,
"isAnonymous": "false",
"isMinor": "false",
"isNew": "false",
"isRobot": "false",
"isUnpatrolled": "false",
"iuser": "00001553",
"metroCode": null,
"namespace": "Talk",
"page": "Talk:Oswald Tilghman",
"regionIsoCode": null,
"regionName": null,
"user": "GELongstreet"
}
```

Metadata dumps generated by this tool are in the same format as returned by the
[SegmentMetadata query](../querying/segmentmetadataquery.html).

### Command line arguments

|argument|description|required?|
|--------|-----------|---------|
|--directory file|Directory containing segment data. This could be generated by unzipping an "index.zip" from deep storage.|yes|
|--output file|File where output will be written.|yes|
|--filter json|JSON-encoded [query filter](../querying/filters.html). Omit to include all rows.|no|
|--column columnName|Column to include. Specify multiple times for multiple columns, or omit to include all columns.|no|
|--time-iso8601|Dump __time column in ISO8601 format rather than long.|no|
|--metadata|Dump metadata instead of actual rows, will ignore --filter and --column selections.|no|
43 changes: 43 additions & 0 deletions processing/src/main/java/io/druid/query/NoopQueryWatcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets 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 io.druid.query;

import com.google.common.util.concurrent.ListenableFuture;

public class NoopQueryWatcher implements QueryWatcher
{
private static final NoopQueryWatcher INSTANCE = new NoopQueryWatcher();

public static NoopQueryWatcher instance()
{
return INSTANCE;
}

private NoopQueryWatcher()
{
// No instantiation
}

@Override
public void registerQuery(Query query, ListenableFuture future)
{
// Do nothing
}
}
Loading

0 comments on commit da660bb

Please sign in to comment.