Skip to content
Permalink
Browse files
[Bug][Vectorized] fix schema change add varchar type column default v…
…alue get wrong result (#9523)
  • Loading branch information
BiteTheDDDDt committed May 19, 2022
1 parent c098586 commit 6951c42d5c4acedef616a6977acca7506c66b227
Showing 2 changed files with 13 additions and 6 deletions.
@@ -353,10 +353,10 @@ Status ColumnReader::new_iterator(ColumnIterator** iterator) {
auto type = (FieldType)_meta.type();
switch (type) {
case FieldType::OLAP_FIELD_TYPE_ARRAY: {
ColumnIterator* item_iterator;
ColumnIterator* item_iterator = nullptr;
RETURN_IF_ERROR(_sub_readers[0]->new_iterator(&item_iterator));

ColumnIterator* offset_iterator;
ColumnIterator* offset_iterator = nullptr;
RETURN_IF_ERROR(_sub_readers[1]->new_iterator(&offset_iterator));

ColumnIterator* null_iterator = nullptr;
@@ -465,7 +465,7 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool

FileColumnIterator::FileColumnIterator(ColumnReader* reader) : _reader(reader) {}

FileColumnIterator::~FileColumnIterator() {}
FileColumnIterator::~FileColumnIterator() = default;

Status FileColumnIterator::seek_to_first() {
RETURN_IF_ERROR(_reader->seek_to_first(&_page_iter));
@@ -491,7 +491,7 @@ Status FileColumnIterator::seek_to_page_start() {
return seek_to_ordinal(_page.first_ordinal);
}

void FileColumnIterator::_seek_to_pos_in_page(ParsedPage* page, ordinal_t offset_in_page) {
void FileColumnIterator::_seek_to_pos_in_page(ParsedPage* page, ordinal_t offset_in_page) const {
if (page->offset_in_page == offset_in_page) {
// fast path, do nothing
return;
@@ -793,7 +793,6 @@ void DefaultValueColumnIterator::insert_default_data(vectorized::MutableColumnPt
dst->insert_many_defaults(n);
break;
}

case OLAP_FIELD_TYPE_DATE: {
assert(_type_size == sizeof(FieldTypeTraits<OLAP_FIELD_TYPE_DATE>::CppType)); //uint24_t
std::string str = FieldTypeTraits<OLAP_FIELD_TYPE_DATE>::to_string(_mem_value);
@@ -826,6 +825,14 @@ void DefaultValueColumnIterator::insert_default_data(vectorized::MutableColumnPt
insert_column_data();
break;
}
case OLAP_FIELD_TYPE_STRING:
case OLAP_FIELD_TYPE_VARCHAR:
case OLAP_FIELD_TYPE_CHAR: {
data_ptr = ((Slice*)_mem_value)->data;
data_len = ((Slice*)_mem_value)->size;
insert_column_data();
break;
}
default: {
data_ptr = (char*)_mem_value;
data_len = _type_size;
@@ -278,7 +278,7 @@ class FileColumnIterator final : public ColumnIterator {
bool is_nullable() { return _reader->is_nullable(); }

private:
void _seek_to_pos_in_page(ParsedPage* page, ordinal_t offset_in_page);
void _seek_to_pos_in_page(ParsedPage* page, ordinal_t offset_in_page) const;
Status _load_next_page(bool* eos);
Status _read_data_page(const OrdinalPageIndexIterator& iter);

0 comments on commit 6951c42

Please sign in to comment.