17 package com.mapd.parser.server.test;
19 import static org.junit.Assert.*;
23 import com.omnisci.thrift.calciteserver.CalciteServer;
24 import com.omnisci.thrift.calciteserver.TPlanResult;
26 import org.apache.thrift.TException;
27 import org.apache.thrift.protocol.TBinaryProtocol;
28 import org.apache.thrift.protocol.TProtocol;
29 import org.apache.thrift.transport.TSocket;
30 import org.apache.thrift.transport.TTransport;
31 import org.junit.AfterClass;
32 import org.junit.BeforeClass;
33 import org.junit.Ignore;
34 import org.junit.Test;
35 import org.slf4j.Logger;
36 import org.slf4j.LoggerFactory;
38 import java.util.ArrayList;
39 import java.util.Random;
40 import java.util.concurrent.ExecutorService;
41 import java.util.concurrent.Executors;
44 private final static Logger
MAPDLOGGER = LoggerFactory.getLogger(TestServer.class);
48 private volatile AssertionError
ae;
56 new Thread(
csw).start();
68 Runnable
r =
new Runnable() {
72 for (
int i = 1;
i <= 5;
i++) {
75 }
catch (AssertionError x) {
76 MAPDLOGGER.error(
"error during Runnable");
90 while (!pool.isShutdown()) {
104 +
" \"id\": \"0\",\n"
105 +
" \"relOp\": \"LogicalTableScan\",\n"
106 +
" \"fieldNames\": [\n"
116 +
" \"SLACKARR1\",\n"
124 +
" \"inputs\": []\n"
127 +
" \"id\": \"1\",\n"
128 +
" \"relOp\": \"LogicalProject\",\n"
148 Random
r =
new Random();
149 int aliasID = r.nextInt(100000) + 1000000;
152 "Select TABALIAS%d.ENAME AS COLALIAS%d from EMP TABALIAS%d LIMIT %d",
160 +
" \"id\": \"0\",\n"
161 +
" \"relOp\": \"LogicalTableScan\",\n"
162 +
" \"fieldNames\": [\n"
172 +
" \"SLACKARR1\",\n"
180 +
" \"inputs\": []\n"
183 +
" \"id\": \"1\",\n"
184 +
" \"relOp\": \"LogicalProject\",\n"
186 +
" \"COLALIAS%d\"\n"
195 +
" \"id\": \"2\",\n"
196 +
" \"relOp\": \"LogicalSort\",\n"
197 +
" \"collation\": [],\n"
199 +
" \"literal\": %d,\n"
200 +
" \"type\": \"DECIMAL\",\n"
202 +
" \"precision\": 7,\n"
203 +
" \"type_scale\": 0,\n"
204 +
" \"type_precision\": 10\n"
208 +
" \"id\": \"3\",\n"
209 +
" \"relOp\": \"LogicalProject\",\n"
211 +
" \"COLALIAS%d\"\n"
220 +
" \"id\": \"4\",\n"
221 +
" \"relOp\": \"LogicalSort\",\n"
222 +
" \"collation\": [],\n"
224 +
" \"literal\": %d,\n"
225 +
" \"type\": \"DECIMAL\",\n"
227 +
" \"precision\": 7,\n"
228 +
" \"type_scale\": 0,\n"
229 +
" \"type_precision\": 10\n"
242 TTransport transport;
243 transport =
new TSocket(
"localhost", 11000);
245 TProtocol protocol =
new TBinaryProtocol(transport);
246 CalciteServer.Client client =
new CalciteServer.Client(protocol);
247 TPlanResult algebra = client.process(
"user",
258 assertEquals(algebra.plan_result, result);
259 }
catch (AssertionError s) {
260 MAPDLOGGER.error(
"error during callCalciteCheck");
263 }
catch (TException x) {
264 fail(
"Exception occurred " + x.toString());
static final int TEST_THREAD_COUNT
volatile boolean threadHadFailure
static CalciteServerWrapper csw
volatile AssertionError ae
static void startServer()
static final Logger MAPDLOGGER
void callCalciteCheck(String query, String result)
static SockTransportProperties client_skT
static SockTransportProperties server_skT