Skip to content

Commit

Permalink
fix map creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Sep 30, 2023
1 parent 53d91db commit 01eeee0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/include/storage/store/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Uncompressed : public CompressionAlg {

static inline uint64_t numValues(uint64_t dataSize, const common::LogicalType& logicalType) {
auto numBytesPerValue = getDataTypeSizeInChunk(logicalType);
return numBytesPerValue == 0 ? 0 : dataSize / numBytesPerValue;
return numBytesPerValue == 0 ? UINT64_MAX : dataSize / numBytesPerValue;
}

inline CompressionMetadata getCompressionMetadata(
Expand Down
7 changes: 5 additions & 2 deletions src/include/storage/store/var_list_column_chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ class VarListColumnChunk : public ColumnChunk {
inline void resizeDataColumnChunk(uint64_t numBytesForBuffer) {
// TODO(bmwinger): This won't work properly for booleans (will be one eighth as many values
// as could fit)
varListDataColumnChunk.resizeBuffer(
numBytesForBuffer / varListDataColumnChunk.dataColumnChunk->getNumBytesPerValue());
auto numValues =
varListDataColumnChunk.dataColumnChunk->getNumBytesPerValue() == 0 ?
0 :
numBytesForBuffer / varListDataColumnChunk.dataColumnChunk->getNumBytesPerValue();
varListDataColumnChunk.resizeBuffer(numValues);
}

private:
Expand Down
3 changes: 2 additions & 1 deletion src/storage/store/var_list_node_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ void VarListNodeColumn::scan(
NodeColumn::scan(nodeGroupIdx, columnChunk);
auto metadata = metadataDA->get(nodeGroupIdx, transaction::TransactionType::READ_ONLY);
varListColumnChunk->setNumValues(metadata.numValues);
varListColumnChunk->resizeDataColumnChunk(metadata.numPages * PageSizeClass::PAGE_4KB);
varListColumnChunk->resizeDataColumnChunk(
metadata.numPages * BufferPoolConstants::PAGE_4KB_SIZE);
dataNodeColumn->scan(nodeGroupIdx, varListColumnChunk->getDataColumnChunk());
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/test_files/tinysnb/update_node/create.test
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,15 @@
-STATEMENT MATCH (a:emptyTable) RETURN a.*
---- 1
2|[1,5,6]

-CASE CreateMap
-STATEMENT CREATE NODE TABLE test(name STRING, m MAP(STRING,STRING), PRIMARY KEY(name));
---- ok
-STATEMENT CREATE (t:test {name:"foo"});
---- ok
-STATEMENT CREATE (t:test {name:"foobar"});
---- ok
-STATEMENT MATCH (t:test) RETURN t.*;
---- 2
foo|
foobar|

0 comments on commit 01eeee0

Please sign in to comment.