OmniSciDB  a5dc49c757
 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  queryParsingOption.is_explain_detail = false;
41 
42  TOptimizationOption optimizationOption = new TOptimizationOption();
43  optimizationOption.is_view_optimize = false;
44  optimizationOption.enable_watchdog = false;
45  optimizationOption.filter_push_down_info = new ArrayList<>();
46 
47  return calciteServerHandler.process(
48  "", "", "", ddlCommand, queryParsingOption, optimizationOption, null);
49  }
50 
51  JsonObject getJsonFromFile(final String fileName) throws Exception {
52  final String filePath = resourceDirPath + "json/ddl/" + jsonTestDir + "/" + fileName;
53  return gson.fromJson(new FileReader(filePath), JsonObject.class);
54  }
55 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:51
CalciteServerHandler calciteServerHandler
Definition: DDLTest.java:24
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:35
static SockTransportProperties getUnencryptedClient()