Skip to content

Conversation

@wuwenchi
Copy link
Contributor

We can create hive table for text format with 'file_format'='text', and set related properties:

create table tb (
    id int,
    `name` string
) PROPERTIES (
    'file_format'='text',
    'compression'='gzip',
    'field.delim'='\t',
    'line.delim'='\n',
    'collection.delim'=';',
    'mapkey.delim'=':',
    'serialization.null.format'='\\N',
    'escape.delim'='\\'
);

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@wuwenchi
Copy link
Contributor Author

run buildall


@VariableMgr.VarAttr(name = HIVE_TEXT_COMPRESSION, needForward = true)
private String hiveTextCompression = "uncompressed";
private String hiveTextCompression = "plain";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change default value? what will happen when upgrade from older version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the compatible process. If user set "uncompressed", it will change to plain

return HiveMetaStoreClientHelper.firstPresentOrDefault(DEFAULT_NULL_FORMAT, nullFormat);
}

public static void updateProperties(Table table, Map<String, String> properties) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment to explain this method

case FORMAT_CSV_PLAIN:
compressType = ConnectContext.get().getSessionVariable().hiveTextCompression();
compressType = targetTable.getRemoteTable().getParameters().get("text.compression");
if (compressType == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (compressType == null) {
if (Strings.isNullOrEmpty(compressType)) {

@morningman
Copy link
Contributor

run buildall

Copy link
Contributor

@suxiaogang223 suxiaogang223 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman merged commit 83c5805 into apache:master Oct 17, 2024
morningman added a commit to morningman/doris that referenced this pull request Oct 21, 2024
We can create hive table for text format with `'file_format'='text'`,
and set related properties:
```sql
create table tb (
    id int,
    `name` string
) PROPERTIES (
    'file_format'='text',
    'compression'='gzip',
    'field.delim'='\t',
    'line.delim'='\n',
    'collection.delim'=';',
    'mapkey.delim'=':',
    'serialization.null.format'='\\N',
    'escape.delim'='\\'
);

```

---------

Co-authored-by: morningman <morningman@163.com>
morningman added a commit that referenced this pull request Oct 21, 2024
cherry pick from #41860

Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
morningman added a commit to morningman/doris that referenced this pull request Oct 21, 2024
We can create hive table for text format with `'file_format'='text'`,
and set related properties:
```sql
create table tb (
    id int,
    `name` string
) PROPERTIES (
    'file_format'='text',
    'compression'='gzip',
    'field.delim'='\t',
    'line.delim'='\n',
    'collection.delim'=';',
    'mapkey.delim'=':',
    'serialization.null.format'='\\N',
    'escape.delim'='\\'
);

```

---------

Co-authored-by: morningman <morningman@163.com>
morningman added a commit that referenced this pull request Oct 21, 2024
cherry pick from #41860

Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
@gavinchou gavinchou mentioned this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants