Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ set (SOURCE_FILES
${PSP_CPP_SRC}/src/cpp/context_one.cpp
${PSP_CPP_SRC}/src/cpp/context_two.cpp
${PSP_CPP_SRC}/src/cpp/context_zero.cpp
${PSP_CPP_SRC}/src/cpp/context_unit.cpp
${PSP_CPP_SRC}/src/cpp/custom_column.cpp
${PSP_CPP_SRC}/src/cpp/data.cpp
${PSP_CPP_SRC}/src/cpp/data_slice.cpp
Expand Down
68 changes: 35 additions & 33 deletions cpp/perspective/src/cpp/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,6 @@

namespace perspective {

// Construct view config
t_config::t_config(const std::vector<std::string>& row_pivots,
const std::vector<std::string>& col_pivots, const std::vector<t_aggspec>& aggregates,
const std::vector<t_sortspec>& sortspecs, const std::vector<t_sortspec>& col_sortspecs,
t_filter_op combiner, const std::vector<t_fterm>& fterms,
const std::vector<std::string>& col_names, bool column_only)
: m_column_only(column_only)
, m_sortspecs(sortspecs)
, m_col_sortspecs(col_sortspecs)
, m_aggregates(aggregates)
, m_detail_columns(col_names) // this should be the columns property
, m_fterms(fterms)
, m_combiner(combiner) {
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
}
for (const auto& p : col_pivots) {
m_col_pivots.push_back(t_pivot(p));
}
};

// t_ctx0
t_config::t_config(
const std::vector<std::string>& detail_columns,
Expand All @@ -41,10 +20,22 @@ t_config::t_config(
const std::vector<t_computed_column_definition>& computed_columns)
: m_detail_columns(detail_columns)
, m_fterms(fterms)
, m_combiner(combiner)
, m_computed_columns(computed_columns)
, m_combiner(combiner)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
setup(m_detail_columns);
if (m_row_pivots.empty() &&
m_col_pivots.empty() &&
m_sortby.empty() &&
m_sortspecs.empty() &&
m_col_sortspecs.empty() &&
m_detail_columns.empty() &&
m_fterms.empty() &&
m_computed_columns.empty()) {
m_is_trivial_config = true;
} else {
m_is_trivial_config = false;
}
}

// t_ctx1
Expand All @@ -55,10 +46,11 @@ t_config::t_config(
t_filter_op combiner,
const std::vector<t_computed_column_definition>& computed_columns)
: m_aggregates(aggregates)
, m_totals(TOTALS_BEFORE)
, m_fterms(fterms)
, m_combiner(combiner)
, m_computed_columns(computed_columns)
, m_combiner(combiner)
, m_is_trivial_config(false)
, m_totals(TOTALS_BEFORE)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
Expand All @@ -76,12 +68,13 @@ t_config::t_config(
t_filter_op combiner,
const std::vector<t_computed_column_definition>& computed_columns,
bool column_only)
: m_column_only(column_only)
, m_aggregates(aggregates)
, m_totals(totals)
: m_aggregates(aggregates)
, m_fterms(fterms)
, m_combiner(combiner)
, m_computed_columns(computed_columns)
, m_combiner(combiner)
, m_column_only(column_only)
, m_is_trivial_config(false)
, m_totals(totals)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
Expand All @@ -101,10 +94,11 @@ t_config::t_config(const std::vector<std::string>& row_pivots,
const std::vector<std::string>& col_pivots, const std::vector<t_aggspec>& aggregates,
const t_totals totals, t_filter_op combiner, const std::vector<t_fterm>& fterms)
: m_aggregates(aggregates)
, m_totals(totals)
, m_fterms(fterms)
, m_combiner(combiner)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
, m_is_trivial_config(false)
, m_totals(totals)
, m_fmode(FMODE_SIMPLE_CLAUSES){
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
}
Expand All @@ -120,16 +114,18 @@ t_config::t_config(
const std::vector<t_pivot>& row_pivots, const std::vector<t_aggspec>& aggregates)
: m_row_pivots(row_pivots)
, m_aggregates(aggregates)
, m_is_trivial_config(false)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
setup(m_detail_columns, std::vector<std::string>{}, std::vector<std::string>{});
}

t_config::t_config(
const std::vector<std::string>& row_pivots, const std::vector<t_aggspec>& aggregates)
: m_aggregates(aggregates)
, m_totals(TOTALS_BEFORE)
, m_combiner(FILTER_OP_AND)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
, m_is_trivial_config(false)
, m_totals(TOTALS_BEFORE)
, m_fmode(FMODE_SIMPLE_CLAUSES){
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
}
Expand All @@ -139,8 +135,9 @@ t_config::t_config(

t_config::t_config(const std::vector<std::string>& row_pivots, const t_aggspec& agg)
: m_aggregates(std::vector<t_aggspec>{agg})
, m_totals(TOTALS_BEFORE)
, m_combiner(FILTER_OP_AND)
, m_is_trivial_config(false)
, m_totals(TOTALS_BEFORE)
, m_fmode(FMODE_SIMPLE_CLAUSES) {
for (const auto& p : row_pivots) {
m_row_pivots.push_back(t_pivot(p));
Expand Down Expand Up @@ -215,6 +212,11 @@ t_config::setup(const std::vector<std::string>& detail_columns,
populate_sortby(m_col_pivots);
}

bool
t_config::is_trivial_config() {
return m_is_trivial_config;
}

void
t_config::populate_sortby(const std::vector<t_pivot>& pivots) {
for (t_index idx = 0, loop_end = pivots.size(); idx < loop_end; ++idx) {
Expand Down
3 changes: 3 additions & 0 deletions cpp/perspective/src/cpp/context_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ t_ctx_handle::get_type_descr() const {
case ZERO_SIDED_CONTEXT: {
return "ZERO_SIDED_CONTEXT";
} break;
case UNIT_CONTEXT: {
return "UNIT_CONTEXT";
} break;
case GROUPED_PKEY_CONTEXT: {
return "GROUPED_PKEY_CONTEXT";
} break;
Expand Down
Loading