Skip to content

Commit

Permalink
feat(tianmu): fixup the default delimeter for load data (#1843)
Browse files Browse the repository at this point in the history
Tianmu default delimiter is ';' not '\t'. In order to follow the mysql convention,
we change the default delimeter to `\t`.
  • Loading branch information
RingsC committed May 31, 2023
1 parent 6cba6d7 commit 1f43e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions storage/tianmu/core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2196,10 +2196,10 @@ common::TianmuError Engine::GetIOP(std::unique_ptr<system::IOParameters> &io_par
if (ex.field.escaped->alloced_length() != 0)
io_params->SetEscapeCharacter(*ex.field.escaped->ptr());

if (ex.field.field_term->alloced_length() != 0)
if (ex.field.field_term->ptr() && strlen(ex.field.field_term->ptr()))
io_params->SetDelimiter(ex.field.field_term->ptr());

if (ex.line.line_term->alloced_length() != 0)
if (ex.line.line_term->ptr() && strlen(ex.line.line_term->ptr()))
io_params->SetLineTerminator(ex.line.line_term->ptr());

if (ex.field.enclosed->length()) {
Expand Down
3 changes: 1 addition & 2 deletions storage/tianmu/loader/parsing_strategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,7 @@ void ParsingStrategy::GetValue(const char *value_ptr, size_t value_size, ushort
auto function = types::ValueParserForText::GetParsingFuntion(ati);
if (function(tmp_string, *reinterpret_cast<int64_t *>(buffer.Prepare(sizeof(int64_t)))) ==
common::ErrorCode::FAILED)
throw common::FormatException(0,
col); // TODO: throw appropriate exception
throw common::FormatException(0, col); // TODO: throw appropriate exception
buffer.ExpectedSize(sizeof(int64_t));
}
}
Expand Down

0 comments on commit 1f43e44

Please sign in to comment.