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{
26 struct OPENMS_DLLAPI ParquetDiffSettings
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;
41 Size max_reported = 25;
42 };
43
50 struct OPENMS_DLLAPI ParquetDiffResult
51 {
53 bool equal = false;
55 std::vector<std::string> schema_errors;
57 std::vector<std::string> key_errors;
59 std::vector<std::string> value_errors;
61 Size suppressed = 0;
62
63 Size rows_1 = 0;
64 Size rows_2 = 0;
65 Size rows_compared = 0;
66
68 double max_ratio = 1.0;
70 double max_absdiff = 0.0;
71
73 std::vector<std::string> primary_key_used;
74 };
75
93 class OPENMS_DLLAPI ParquetTableComparator
94 {
95 public:
108 static ParquetDiffResult compare(const std::string& file_1,
109 const std::string& file_2,
110 const ParquetDiffSettings& settings);
111
125 static ParquetDiffResult validate(const std::string& file,
126 const std::string& view,
127 const ParquetDiffSettings& settings);
128
136 static std::vector<std::string> qpxPrimaryKey(const std::string& view);
137
144 static std::string viewFromFileType(const std::string& file_type);
145 };
146
147} // namespace OpenMS
Primary-key-aware, order-insensitive, tolerant comparison of Parquet tables.
Definition ParquetTableComparator.h:94
static ParquetDiffResult validate(const std::string &file, const std::string &view, const ParquetDiffSettings &settings)
Check one Parquet file against a built-in QPX schema.
static ParquetDiffResult compare(const std::string &file_1, const std::string &file_2, const ParquetDiffSettings &settings)
Compare two Parquet files.
static std::vector< std::string > qpxPrimaryKey(const std::string &view)
The primary key of a QPX view.
static std::string viewFromFileType(const std::string &file_type)
Map a QPX file_type metadata value to a view name.
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:59
std::vector< std::string > ignore_columns
Columns excluded from value comparison (they are still schema-checked).
Definition ParquetTableComparator.h:31
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
std::vector< std::string > schema_errors
Missing/extra columns, differing Arrow types, differing nullability.
Definition ParquetTableComparator.h:55
std::vector< std::string > primary_key_used
The primary key actually used, whether supplied or auto-detected.
Definition ParquetTableComparator.h:73
std::vector< std::string > key_errors
Duplicate primary keys, and keys present in only one of the two tables.
Definition ParquetTableComparator.h:57
Outcome of a table comparison.
Definition ParquetTableComparator.h:51
Settings for ParquetTableComparator.
Definition ParquetTableComparator.h:27