Unable to connect to Mapd through Apache Thrift


The code which I used was downloaded from following link:

This is the code in browser.js under the examples folder after I modified it:

const query=“SELECT count() AS n FROM data_hewei WHERE direction=180"
const defaultQueryOptions={}
const connector=new window.MapdCon()
.then(session =>
.then(values =>{
"There are " + values[0][0].n + “track points from QingdaoData.”
console.log(“Query 1 results:”,Number(values[0][0].n))
.catch(error => {
console.error(“Something bad happened;”,error)

When I opened the broser.html under the examples folder,it didn’t return anything.Is there anything wrong?
Who can help me,I’m looking forward to your reply!


@sun I’m not an expert on the connector, but I can get ahold of someone who is. Meanwhile, what happens if you add a semicolon to the end of your query?


Thank you for your reply.:grinning:
I added a semicolon after my query and it still didn’t return anything.After all,the example code itself has no semicolon.
There was a time that I found that my query had reached mapd by looking at the mapd_log file under my MAPD_STORAGE directory,the problem is that mapd does not return the query results to my JS.
But now,my query cannot even reach mapd.What should I do?


OK, just checking! We have an engineer that’s going to attempt to repro later today. Anything more you can share about your modifications to javascript, your environment, or the results from the mapd_log from earlier would be helpful.

I’m guessing it’s not your data if there’s no connection between the database and your script.


@easy It’s very kind of you! My operating system is Ubuntu16.04.The browser I’m using is Google Chrome.My database and script are in the same machine.
By the way,It is my data.I imported it into my Mapd database.The “data_hewei” is the table name of my data.


The following is the results from the mapd_log in 20180611-1935.We can see that the JS has reached the Mapd at that time.But now,my JS can not connect to Mapd.

sql_execute :KmliOQUpsrmxECkyERjPHhGbFoLWbjzc:query_str:SELECT COUNT() as n FROM data_hewei
I0611 19:35:21.167819 3183 Calcite.cpp:277] User mapd catalog mapd sql 'SELECT COUNT(
) as n FROM data_hewei’
I0611 19:35:23.711410 3183 Calcite.cpp:290] Time in Thrift 7 (ms), Time in Java Calcite server 2536 (ms)
I0611 19:35:23.712205 3172 Calcite.cpp:290] Time in Thrift 59 (ms), Time in Java Calcite server 3552 (ms)
I0611 19:35:24.482969 3189 BufferMgr.cpp:283] ALLOCATION slab of 4194304 pages (2147483648B) created in 55 ms GPU_MGR:0
I0611 19:35:24.514601 3183 MapDHandler.cpp:600] sql_execute-COMPLETED Total: 3347 (ms), Execution: 3311 (ms)
I0611 19:35:24.536969 3172 MapDHandler.cpp:600] sql_execute-COMPLETED Total: 4459 (ms), Execution: 3667 (ms)
I0611 19:35:26.378123 3172 MapDHandler.cpp:574] sql_execute :KmliOQUpsrmxECkyERjPHhGbFoLWbjzc:query_str:SELECT COUNT() as n FROM data_hewei
I0611 19:35:26.379385 3172 Calcite.cpp:277] User mapd catalog mapd sql 'SELECT COUNT(
) as n FROM data_hewei’
I0611 19:35:26.505933 3172 Calcite.cpp:290] Time in Thrift 10 (ms), Time in Java Calcite server 116 (ms)
I0611 19:35:26.533308 3172 MapDHandler.cpp:600] sql_execute-COMPLETED Total: 154 (ms), Execution: 153 (ms)


Hi. The query looks right and the logs seem to say that it went through. Can you share a bit more of the JS code that you say doesn’t connect to MapD?


@biovisualize Hi. I’m sorry to tell you that my JS code has been shown in the first post.What’s more,“result-async” is the result that will be shown in browser.html.