Skip to content
Permalink
Browse files
Supplementary information for add segment syntax .
1. add segment option (partition)
2. segment-management-on-carbondata.md link addsegment-guide.md
  • Loading branch information
bieremayi committed Nov 25, 2021
1 parent 3be05d2 commit 81c2e29604d66e35f3757122cbc7cda0ed463cac
Showing 2 changed files with 41 additions and 4 deletions.
@@ -27,10 +27,46 @@ Heterogeneous format segments aims to solve this problem by avoiding data conver
### Add segment with path and format
Users can add the existing data as a segment to the carbon table provided the schema of the data
and the carbon table should be the same.

Syntax

```
ALTER TABLE [db_name.]table_name ADD SEGMENT OPTIONS(property_name=property_value, ...)
```

**Supported properties:**

| Property | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [PATH](#path) | User external old table path |
| [FORMAT](#format) | User external old table file format |
| [PARTITION](#partition) | Extract partition info for partition table , should be form of "a:int, b:string" |


-
You can use the following options to add segment:

- ##### PATH:
User old table path.

```
OPTIONS('PATH'='hdfs://usr/oldtable')
```

- ##### FORMAT:
User old table file format. eg : json, parquet, jdbc, orc, csv, text

```
OPTIONS('FORMAT'='parquet')
```
- ##### PARTITION:
Extract partition info for partition table , should be form of "a:int, b:string"

```
OPTIONS('PARTITION'='a:int, b:string')
```


```
alter table table_name add segment options ('path'= 'hdfs://usr/oldtable','format'='parquet')
```
In the above command user can add the existing data to the carbon table as a new segment and also
can provide the data format.

@@ -25,6 +25,7 @@ concept which helps to maintain consistency of data and easy transaction managem
- [Delete Segment by ID](#delete-segment-by-id)
- [Delete Segment by Date](#delete-segment-by-date)
- [Query Data with Specified Segments](#query-data-with-specified-segments)
- [Add Segment](./addsegment-guide.md)

### SHOW SEGMENT

@@ -207,4 +208,4 @@ concept which helps to maintain consistency of data and easy transaction managem
spark.sql("select count(empno) from carbon.input.segments.db.carbontable_Multi_Thread").show();
}
}
```
```

0 comments on commit 81c2e29

Please sign in to comment.