OpenMS
Loading...
Searching...
No Matches
ParquetTableComparator.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12#include <OpenMS/OpenMSConfig.h>
13
14#include <string>
15#include <vector>
16
17namespace OpenMS
18{
27 {
29 std::vector<std::string> primary_key;
31 std::vector<std::string> ignore_columns;
33 double acceptable_ratio = 1.0;
35 double acceptable_absdiff = 0.0;
37 bool schema_only = false;
39 bool unordered_lists = false;
57 };
58
66 {
68 bool equal = false;
70 std::vector<std::string> schema_errors;
72 std::vector<std::string> key_errors;
74 std::vector<std::string> value_errors;
77
81
83 double max_ratio = 1.0;
85 double max_absdiff = 0.0;
86
88 std::vector<std::string> primary_key_used;
89 };
90
109 {
110 public:
123 static ParquetDiffResult compare(const std::string& file_1,
124 const std::string& file_2,
125 const ParquetDiffSettings& settings);
126
140 static ParquetDiffResult validate(const std::string& file,
141 const std::string& view,
142 const ParquetDiffSettings& settings);
143
165 static bool dumpToTsv(const std::string& file,
166 const std::string& out_file,
167 const ParquetDiffSettings& settings);
168
176 static std::vector<std::string> qpxPrimaryKey(const std::string& view);
177
190 static std::vector<std::string> qpxIdentityColumns(const std::string& view);
191
198 static std::string viewFromFileType(const std::string& file_type);
199 };
200
201} // namespace OpenMS
Primary-key-aware, order-insensitive, tolerant comparison of Parquet tables.
Definition ParquetTableComparator.h:109
static std::vector< std::string > qpxPrimaryKey(const std::string &view)
The primary key of a QPX view.
Definition ParquetTableComparator.cpp:638
static ParquetDiffResult validate(const std::string &file, const std::string &view, const ParquetDiffSettings &settings)
Check one Parquet file against a built-in QPX schema.
Definition ParquetTableComparator.cpp:825
static std::string viewFromFileType(const std::string &file_type)
Map a QPX file_type metadata value to a view name.
Definition ParquetTableComparator.cpp:606
static ParquetDiffResult compare(const std::string &file_1, const std::string &file_2, const ParquetDiffSettings &settings)
Compare two Parquet files.
Definition ParquetTableComparator.cpp:672
static bool dumpToTsv(const std::string &file, const std::string &out_file, const ParquetDiffSettings &settings)
Write a Parquet table out as TSV, one row per line, sorted by primary key.
Definition ParquetTableComparator.cpp:937
static std::vector< std::string > qpxIdentityColumns(const std::string &view)
The opaque identity and cross-reference columns of a QPX view.
Definition ParquetTableComparator.cpp:614
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::vector< std::string > value_errors
Per-cell differences, prefixed by the primary key of the row they occur in.
Definition ParquetTableComparator.h:74
std::vector< std::string > ignore_columns
Columns excluded from value comparison (they are still schema-checked).
Definition ParquetTableComparator.h:31
Size max_reported
Stop collecting messages of any one category after this many (0 = unlimited).
Definition ParquetTableComparator.h:41
double max_ratio
Largest ratio observed between two numeric cells (1.0 when all were identical).
Definition ParquetTableComparator.h:83
Size suppressed
Number of messages suppressed by ParquetDiffSettings::max_reported.
Definition ParquetTableComparator.h:76
Size rows_compared
rows matched by primary key and compared cell-by-cell
Definition ParquetTableComparator.h:80
bool unordered_lists
Compare list-valued cells as multisets rather than sequences.
Definition ParquetTableComparator.h:39
double max_absdiff
Largest absolute difference observed between two numeric cells.
Definition ParquetTableComparator.h:85
std::vector< std::string > primary_key
Columns forming the primary key. Empty: derive from the file's QPX file_type metadata.
Definition ParquetTableComparator.h:29
bool schema_only
Compare schemas only; skip key building and value comparison.
Definition ParquetTableComparator.h:37
std::vector< std::string > schema_errors
Missing/extra columns, differing Arrow types, differing nullability.
Definition ParquetTableComparator.h:70
std::vector< std::string > primary_key_used
The primary key actually used, whether supplied or auto-detected.
Definition ParquetTableComparator.h:88
Size rows_1
row count of the first table
Definition ParquetTableComparator.h:78
double acceptable_ratio
Maximum acceptable ratio max(|a|,|b|)/min(|a|,|b|) of two numbers. 1.0 = must be identical.
Definition ParquetTableComparator.h:33
double acceptable_absdiff
Maximum acceptable |a-b| of two numbers.
Definition ParquetTableComparator.h:35
bool compare_identity_columns
Definition ParquetTableComparator.h:56
std::vector< std::string > key_errors
Duplicate primary keys, and keys present in only one of the two tables.
Definition ParquetTableComparator.h:72
Size rows_2
row count of the second table
Definition ParquetTableComparator.h:79
bool equal
True when no schema, key or value difference was found.
Definition ParquetTableComparator.h:68
Outcome of a table comparison.
Definition ParquetTableComparator.h:66
Settings for ParquetTableComparator.
Definition ParquetTableComparator.h:27