GithubHelp home page GithubHelp logo

chernishev / toydbms-old Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 5.0 27 KB

Toy DBMS for students of Saint-Petersburg Academic University

License: GNU General Public License v3.0

C++ 98.47% Makefile 1.53%

toydbms-old's People

Contributors

chernishev avatar dkhalansky avatar ldvsoft avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

toydbms-old's Issues

`PJoinNode` incorrectly calculates number of the column to perform JOIN on

The following code makes no sense:

    std::ptrdiff_t lpos1 = std::find(ln[i].begin(), ln[i].end(), ((LJoinNode*)prototype)->offset1) - ln[i].begin();
    std::ptrdiff_t lpos2 = std::find(ln[i].begin(), ln[i].end(), ((LJoinNode*)prototype)->offset2) - ln[i].begin();

    if (lpos1 <= ln.size() || lpos1 <= ln.size()) {
      if (lpos1 < lpos2)
        lpos = lpos1;
      else
        lpos = lpos2;
      break;
    }

For instance, the condition in the first if compares index in ln[i] with size of ln, which is meaningless. Also, lpos is assigned an index from ln[i] and it's later used as a column id, which makes no sense as well.

Example where this does not work: just make id column in table the last column and run demo

`LJoinNode::fieldOrders` is calculated incorrectly

Assuming that fieldOrders vector should contain invariant about order of rows corresponding to that field, LJoinNode initiates it incorrectly: it assumes that all non-joined columns remain sorted in the same way as they were. However, it's clearly not the case, e.g. if we join these two tables on column A:

| A | B |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |

| A | C |
| 3 | 1 |
| 1 | 2 |
| 3 | 3 |

After join, column C will become unsorted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.