Coder Social home page Coder Social logo

Comments (7)

chaudum avatar chaudum commented on June 17, 2024

Hi @megastef
Thanks for raising the issue.
I quickly tested, but found out that both CREATE TABLE and CREATE BLOB TABLE do return the rows property in the response json.

CREATE TABLE example

httpie POST http://127.0.0.1:4200/_sql stmt='create table foo (id integer, name string)'
HTTP/1.1 200 OK
Content-Length: 49
Content-Type: application/json; charset=UTF-8

{
    "cols": [],
    "duration": 142,
    "rowcount": 1,
    "rows": []
}

CREATE BLOB TABLE example

httpie POST http://127.0.0.1:4200/_sql stmt='create blob table my_blobs'
HTTP/1.1 200 OK
Content-Length: 49
Content-Type: application/json; charset=UTF-8

{
    "cols": [],
    "duration": 221,
    "rowcount": 1,
    "rows": []
}

Please let me know if I misunderstood the issue. What version of Crate to you use? Would be great if you could provide an example where it fails.

Best, Christian

from crate.

megastef avatar megastef commented on June 17, 2024

I digged again into "CREATE BLOB TABLE":

We send this to the _sql endpoint:

{"stmt":"CREATE BLOB TABLE blobtest clustered into ? shards with (number_of_replicas=?)","args":[1,3]}

We get back this:

{ error: 
   { message: 'SQLActionException[line 1:43: mismatched input \'?\' expecting INTEGER_VALUE]',
     code: 4000 },
  rows: [] }

It happened in Version 0.40.4. Any advise? It looks the args are interpreted as string and not as number.
By the way: In this case "row count" is not set.

from crate.

mfelsche avatar mfelsche commented on June 17, 2024

hi @megastef,
the actual issue here is that the clustered into clause does not accept a parameter.
Do you need a parameter to provide a value for the number of shards?

from crate.

megastef avatar megastef commented on June 17, 2024

Ok, I fixed it by generating a string and not passing parameters in in "args" array. So the node.js driver provides this function including shards and replicas since 1.0.8. Maybe you close this one and its up to you if you open a new issue for it.

Actually it looks now like this:

exports.createBlobTable = function createBlobTable(tableName, replicas, shards, cbf) {
    var statement = "CREATE BLOB TABLE " + tableName + " clustered into " + shards + " shards with (number_of_replicas=" + replicas + ")";
    // [shards, replicas]
    executeSql(statement, [], cbf);
};

from crate.

mfussenegger avatar mfussenegger commented on June 17, 2024

Just merged a PR that will allow parameters in the clustered into clause: #1067

It will also be part of the next 0.41 bugfix release.

Is that row count isn't set still a problem or can I close the issue here?

from crate.

megastef avatar megastef commented on June 17, 2024

Thanks. You can close it - I guess the inital failure was as we introduced the shards/replicas. We can update the driver in the future to use the args again for create blob table, when we got the possibility to query CRATE version number. @chaudum showed that rowcount is present in case of success.

from crate.

mfussenegger avatar mfussenegger commented on June 17, 2024

Ok great so I am closing this.

Btw you can get the crate version if you do a GET request on the root '/' endpoint.

from crate.

Related Issues (20)

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.