Skip to content
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

The DataSet merge method exist bug #4435

Closed
Linary opened this issue Jul 18, 2022 · 0 comments
Closed

The DataSet merge method exist bug #4435

Linary opened this issue Jul 18, 2022 · 0 comments
Labels
severity/minor Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@Linary
Copy link
Contributor

Linary commented Jul 18, 2022

Please check the FAQ documentation before raising an issue

Describe the bug (required)

The merge method of DataSet exist bug:

  • colNames insert at the end position of origin colNames;
  • rowValues insert at the begin position of origin rowValues;
  // merge two DataSet Horizontally with same row count
  bool merge(DataSet&& o) {
    if (rowSize() != o.rowSize()) {
      return false;
    }
    auto newColSize = colSize() + o.colSize();
    colNames.reserve(newColSize);
    // at end
    colNames.insert(colNames.end(),
                    std::make_move_iterator(o.colNames.begin()),
                    std::make_move_iterator(o.colNames.end()));
    for (std::size_t i = 0; i < rowSize(); ++i) {
      rows[i].values.reserve(newColSize);
      // at begin
      rows[i].values.insert(rows[i].values.begin(),
                            std::make_move_iterator(o.rows[i].values.begin()),
                            std::make_move_iterator(o.rows[i].values.end()));
    }
    return true;
  }

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:

  1. Step 1 : define DataSet1
nebula::DataSet data1({"col1", "col2", "col3"});
data1.emplace_back(nebula::Row({1, 2, 3}));
  1. Step 2 : define DataSet2
nebula::DataSet data2({"col4", "col5"});
data2.emplace_back(nebula::Row({4, 5}));
  1. Step 3 : merge DataSet1 and DataSet2
data1.merge(std::move(data2));

Expected behavior

data1 should be

col1 col2 col3 col4 col5
1 2 3 4 5

Actual behavior

data1 is

col1 col2 col3 col4 col5
4 5 1 2 3

Additional context

@Linary Linary added the type/bug Type: something is unexpected label Jul 18, 2022
@Sophie-Xie Sophie-Xie added this to the v3.3.0 milestone Jul 18, 2022
@jinyingsunny jinyingsunny added the severity/minor Severity of bug label Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

3 participants