1 package com.mapd.parser.extension.ddl;
3 import com.google.gson.annotations.Expose;
5 import org.apache.calcite.sql.SqlDdl;
6 import org.apache.calcite.sql.SqlKind;
7 import org.apache.calcite.sql.SqlNode;
9 import org.apache.calcite.sql.SqlSpecialOperator;
10 import org.apache.calcite.sql.parser.SqlParserPos;
12 import org.apache.calcite.util.JsonBuilder;
13 import org.apache.calcite.util.Pair;
15 import java.util.ArrayList;
16 import java.util.List;
24 new SqlSpecialOperator(
"RENAME_TABLE", SqlKind.OTHER_DDL);
27 private List<Pair<String, String>>
tableNames =
new ArrayList<Pair<String, String>>();
30 final SqlParserPos pos,
final List<Pair<String, String>> tableNamesIn) {
32 this.tableNames = tableNamesIn;
43 Map<String, Object> map = jsonBuilder.map();
45 map.put(
"command",
"RENAME_TABLE");
47 List<Object> elements_list = jsonBuilder.list();
48 for (Pair<String, String> value : this.
tableNames) {
49 Map<String, Object> pairMap = jsonBuilder.map();
50 pairMap.put(
"name", value.left);
51 pairMap.put(
"newName", value.right);
52 elements_list.add(pairMap);
54 map.put(
"tableNames", elements_list);
56 Map<String, Object> payload = jsonBuilder.map();
57 payload.put(
"payload", map);
62 return jsonBuilder.toJsonString(payload);
static final SqlOperator OPERATOR
SqlRenameTable(final SqlParserPos pos, final List< Pair< String, String >> tableNamesIn)
List< Pair< String, String > > tableNames
List< SqlNode > getOperandList()