-
Notifications
You must be signed in to change notification settings - Fork 71
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
clp-s: Update core functionality to prepare for generic parser support #355
Changes from 35 commits
3e0435c
5b8c97c
d5440c1
1f3b1f3
959f7a8
7ea6eb4
8bc1356
87502f3
f6b8aa5
86d7a8d
8cf5f0c
624f4c4
29952c8
994946f
c2ea3b6
cd812e5
be178be
456ab68
8ed2f83
f686756
7007c8a
7ee691e
5c7e6f9
36496b5
a0ac519
c67b85b
acf8b92
edd32b2
8c1f015
7d1e236
61a302c
3ec2ac6
e09ae8e
952a97f
262ac9e
ba7b844
be045e2
96596e6
e673487
d5218e1
33fe38f
870da2f
f37b57c
dd66174
ac1d5b1
2374dfa
ab35d8c
0800800
36c80a5
8dba752
21c5611
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include "ReaderUtils.hpp" | ||
#include "SchemaReader.hpp" | ||
#include "TimestampDictionaryReader.hpp" | ||
#include "Utils.hpp" | ||
|
||
namespace clp_s { | ||
class ArchiveReader { | ||
|
@@ -87,7 +88,7 @@ class ArchiveReader { | |
* @param should_marshal_records | ||
* @return the schema reader | ||
*/ | ||
std::unique_ptr<SchemaReader> | ||
SchemaReader& | ||
read_table(int32_t schema_id, bool should_extract_timestamp, bool should_marshal_records); | ||
|
||
std::shared_ptr<VariableDictionaryReader> get_variable_dictionary() { return m_var_dict; } | ||
|
@@ -128,7 +129,7 @@ class ArchiveReader { | |
* @param should_extract_timestamp | ||
* @param should_marshal_records | ||
*/ | ||
gibber9809 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::unique_ptr<SchemaReader> create_schema_reader( | ||
SchemaReader& create_schema_reader( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add the return value in the description? |
||
int32_t schema_id, | ||
bool should_extract_timestamp, | ||
bool should_marshal_records | ||
|
@@ -139,8 +140,20 @@ class ArchiveReader { | |
* @param reader | ||
* @param column_id | ||
*/ | ||
BaseColumnReader* | ||
append_reader_column(std::unique_ptr<SchemaReader>& reader, int32_t column_id); | ||
BaseColumnReader* append_reader_column(SchemaReader& reader, int32_t column_id); | ||
|
||
/** | ||
* Appends columns for the entire schema of an unordered object. | ||
* @param reader | ||
* @param column_id | ||
gibber9809 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @param should_marshal_records | ||
*/ | ||
void append_unordered_reader_columns( | ||
SchemaReader& reader, | ||
NodeType unordered_object_type, | ||
Span<int32_t> schema_ids, | ||
bool should_marshal_records | ||
); | ||
|
||
bool m_is_open; | ||
std::string m_archive_path; | ||
|
@@ -159,6 +172,7 @@ class ArchiveReader { | |
FileReader m_table_metadata_file_reader; | ||
ZstdDecompressor m_tables_decompressor; | ||
ZstdDecompressor m_table_metadata_decompressor; | ||
SchemaReader m_schema_reader{nullptr, -1, {nullptr, 0}, 0, false}; | ||
}; | ||
} // namespace clp_s | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,32 +92,35 @@ size_t ArchiveWriter::get_data_size() { | |
|
||
void ArchiveWriter::initialize_schema_writer(SchemaWriter* writer, Schema const& schema) { | ||
for (int32_t id : schema) { | ||
auto node = m_schema_tree.get_node(id); | ||
switch (node->get_type()) { | ||
case NodeType::INTEGER: | ||
if (Schema::schema_entry_is_unordered_object(id)) { | ||
continue; | ||
} | ||
auto const& node = m_schema_tree.get_node(id); | ||
switch (node.get_type()) { | ||
case NodeType::Integer: | ||
writer->append_column(new Int64ColumnWriter(id)); | ||
break; | ||
case NodeType::FLOAT: | ||
case NodeType::Float: | ||
writer->append_column(new FloatColumnWriter(id)); | ||
break; | ||
case NodeType::CLPSTRING: | ||
case NodeType::ClpString: | ||
writer->append_column(new ClpStringColumnWriter(id, m_var_dict, m_log_dict)); | ||
break; | ||
case NodeType::VARSTRING: | ||
case NodeType::VarString: | ||
writer->append_column(new VariableStringColumnWriter(id, m_var_dict)); | ||
break; | ||
case NodeType::BOOLEAN: | ||
case NodeType::Boolean: | ||
writer->append_column(new BooleanColumnWriter(id)); | ||
break; | ||
case NodeType::ARRAY: | ||
case NodeType::UnstructuredArray: | ||
writer->append_column(new ClpStringColumnWriter(id, m_var_dict, m_array_dict)); | ||
break; | ||
case NodeType::DATESTRING: | ||
case NodeType::DateString: | ||
writer->append_column(new DateStringColumnWriter(id)); | ||
break; | ||
case NodeType::OBJECT: | ||
case NodeType::NULLVALUE: | ||
case NodeType::UNKNOWN: | ||
case NodeType::Object: | ||
case NodeType::NullValue: | ||
case NodeType::Unknown: | ||
break; | ||
} | ||
} | ||
|
@@ -141,9 +144,11 @@ size_t ArchiveWriter::store_tables() { | |
m_table_metadata_compressor.write_numeric_value(m_tables_file_writer.get_pos()); | ||
|
||
m_tables_compressor.open(m_tables_file_writer, m_compression_level); | ||
i.second->store(m_tables_compressor); | ||
size_t table_image_size = i.second->store(m_tables_compressor); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change the name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure how about "uncompressed_size"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to me |
||
m_tables_compressor.close(); | ||
delete i.second; | ||
|
||
m_table_metadata_compressor.write_numeric_value(table_image_size); | ||
} | ||
m_table_metadata_compressor.close(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to change
object_readers_begin
to something like...begin_pos
or...begin_offset
?