Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty default value bug #117

Merged
merged 24 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dbms/src/Debug/MockTiDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ ColumnInfo getColumnInfoFromColumn(const NameAndTypePair & column, ColumnID id)
if (checkDataType<DataTypeUInt64>(nested_type))
column_info.tp = TiDB::TypeLongLong;

// Default value.
// TODO: Parse default value and set flag properly.
column_info.setNoDefaultValueFlag();

return column_info;
}

Expand Down
8 changes: 6 additions & 2 deletions dbms/src/Storages/Transaction/RegionBlockReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,12 @@ std::tuple<Block, bool> readRegionBlock(const TiDB::TableInfo & table_info,
return std::make_tuple(block, false);

row.emplace_back(Field(column.id));
// Fill `zero` value if NOT NULL specified or else NULL.
row.push_back(column.defaultValueToField());
if (column.hasNoDefaultValueFlag())
// Fill `zero` value if NOT NULL specified or else NULL.
row.push_back(column.hasNotNullFlag() ? GenDecodeRow(column.getCodecFlag()) : Field());
else
// Fill default value.
row.push_back(column.defaultValueToField());
}

// Remove values of non-existing columns, which could be data inserted (but not flushed) before DDLs that drop some columns.
Expand Down