Giter Site home page Giter Site logo

fakesdb's People

Contributors

dwhjames avatar gorkunov avatar ogrodnek avatar

Stargazers

 avatar

Watchers

 avatar  avatar

fakesdb's Issues

the like and not like query operators do not properly escape strings

Consider the following query:

select * from mydomain where Rating like '****%'

To turn the comparison string '****%' into a regular expression, we must use the Scala string """\*\*\*.*""". We must also allow for escaping of %, so the comparison string '%3\%' should become """.*3%""".

incorrect implementation of `and` and `or` operators

The and operator, for composing predicates, has the same implementation of intersection. Consider the following query:

select * from mydomain where Keyword = 'Book' and Keyword = 'Hardcover'

This can’t return anything other than the empty set, as a Keyword attribute can’t be both 'Book' and 'Hardcover'.

There are several important things to understand about predicate execution against attributes with multiple values:

  1. Each attribute value is considered individually against the comparison conditions defined in the predicate.
  2. Item names will be selected if ANY of the values match the predicate condition

Instead, the intersection operator will intersect the sets that satisfy each predicate independently. The following query can be successful.

select * from mydomain where Keyword = 'Book' intersection Keyword = 'Hardcover'

The and operator is incorrectly implemented as the intersection operator. Furthermore, the or operator is implemented as a union operation, which, while it still it gives the correct result, is more costly than necessary, just as with intersection.

(See Multiple Attribute Queries)

itemName() not supported in where clause

Consider the following query:

select itemName() from mydomain where itemName() like 'B000%' order by itemName()

The identifier itemName() is not recognized and given special treatment in where clause predicates.

no validation on ordering clauses

From the Amazon SimpleDB documentation on Sorting

All sort operations are performed in lexicographical order.

The sort attribute must be present in at least one of the predicates of the expression.

Because returned results must contain the attribute on which you are sorting, do not use is null on the sort attribute. For example, select * from mydomain where author is null and title is not null order by title will succeed. However, select * from mydomain where author is null order by title will fail because title is not constrained by the not null predicate.

The following query should throw an InvalidSortExpression exception:

select * from mydomain order by Year asc

with the error message

The sort attribute must be present in at least one of the predicates, and the predicate cannot contain the is null operator.

The every() comparison operator is only partially implemented

The following query is unsupported by the query parser:

select * from mydomain where every(keyword) in ('Book', 'Paperback')

(Taken from the SimpleDB Documentation for Queries on Attributes with Multiple Values)

Each attribute is considered individually against the comparison conditions defined in the predicate. Item names are selected if any of the values match the predicate condition. To change this behavior, use the every() operator to return results where every attribute matches the query expression.

Currently, only the binary operators are supported: =, !=, >, <, >=, <=, like, not like.

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.