OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlterTableTest.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import static org.junit.Assert.assertEquals;
4 
5 import com.google.gson.Gson;
6 import com.google.gson.JsonObject;
8 
9 import org.junit.Test;
10 
11 import ai.heavy.thrift.calciteserver.TPlanResult;
12 
13 public class AlterTableTest extends DDLTest {
14  public AlterTableTest() {
15  resourceDirPath = AlterTableTest.class.getClassLoader().getResource("").getPath();
16  jsonTestDir = "table";
17  }
18 
19  @Test
20  public void AlterTableAlterColumn() throws Exception {
21  final JsonObject expectedJsonObject =
22  getJsonFromFile("alter_table_alter_column.json");
23  final TPlanResult result = processDdlCommand(
24  "ALTER TABLE test ALTER COLUMN a TYPE decimal(5,2) NULL, ALTER COLUMN b SET DATA TYPE TEXT NOT NULL ENCODING DICT(32);");
25  final JsonObject actualJsonObject =
26  gson.fromJson(result.plan_result, JsonObject.class);
27 
28  assertEquals(expectedJsonObject, actualJsonObject);
29  }
30 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:51
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:35