OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DDLTest.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.fail;
5 
6 import com.google.gson.Gson;
7 import com.google.gson.JsonObject;
10 
11 import org.junit.Before;
12 
13 import java.io.FileReader;
14 import java.util.ArrayList;
15 
16 import ai.heavy.thrift.calciteserver.TOptimizationOption;
17 import ai.heavy.thrift.calciteserver.TPlanResult;
18 import ai.heavy.thrift.calciteserver.TQueryParsingOption;
19 
20 public class DDLTest {
21  protected String resourceDirPath;
22  protected static final Gson gson = new Gson();
23  protected String jsonTestDir;
25 
26  @Before
27  public void setup() throws Exception {
29  "",
30  resourceDirPath + "ast/test_extension_functions.ast",
32  "");
33  }
34 
35  TPlanResult processDdlCommand(final String ddlCommand) throws Exception {
36  TQueryParsingOption queryParsingOption = new TQueryParsingOption();
37  queryParsingOption.legacy_syntax = false;
38  queryParsingOption.is_explain = false;
39  queryParsingOption.check_privileges = false;
40 
41  TOptimizationOption optimizationOption = new TOptimizationOption();
42  optimizationOption.is_view_optimize = false;
43  optimizationOption.enable_watchdog = false;
44  optimizationOption.filter_push_down_info = new ArrayList<>();
45 
46  return calciteServerHandler.process(
47  "", "", "", ddlCommand, queryParsingOption, optimizationOption, null);
48  }
49 
50  JsonObject getJsonFromFile(final String fileName) throws Exception {
51  final String filePath = resourceDirPath + "json/ddl/" + jsonTestDir + "/" + fileName;
52  return gson.fromJson(new FileReader(filePath), JsonObject.class);
53  }
54 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:50
CalciteServerHandler calciteServerHandler
Definition: DDLTest.java:24
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:35
static SockTransportProperties getUnencryptedClient()