From 51cbf0f23e288bf8c1657657c1e32611d42c0c3f Mon Sep 17 00:00:00 2001 From: RingsC Date: Wed, 31 May 2023 17:25:27 +0800 Subject: [PATCH] feat(tianmu): fixup the default delimeter for load data Tianmu default delimiter is ';' not '\t'. In order to follow the mysql convention, we change the default delimeter to `\t`. --- storage/tianmu/core/engine.cpp | 4 ++-- storage/tianmu/loader/parsing_strategy.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/storage/tianmu/core/engine.cpp b/storage/tianmu/core/engine.cpp index 1f13407f7..78ad25bc3 100644 --- a/storage/tianmu/core/engine.cpp +++ b/storage/tianmu/core/engine.cpp @@ -2195,10 +2195,10 @@ common::TianmuError Engine::GetIOP(std::unique_ptr &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()) { diff --git a/storage/tianmu/loader/parsing_strategy.cpp b/storage/tianmu/loader/parsing_strategy.cpp index f11fee4c3..27d020562 100644 --- a/storage/tianmu/loader/parsing_strategy.cpp +++ b/storage/tianmu/loader/parsing_strategy.cpp @@ -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(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)); } }