OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MapDSchema.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package com.mapd.calcite.parser;
7 
10 
11 import org.apache.calcite.linq4j.tree.Expression;
12 import org.apache.calcite.rel.type.RelProtoDataType;
13 import org.apache.calcite.schema.Function;
14 import org.apache.calcite.schema.Schema;
15 import org.apache.calcite.schema.SchemaPlus;
16 import org.apache.calcite.schema.SchemaVersion;
17 import org.apache.calcite.schema.Table;
18 import org.apache.calcite.util.ConversionUtil;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21 
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.HashSet;
25 import java.util.Set;
26 
31 public class MapDSchema implements Schema {
32  final static Logger MAPDLOGGER = LoggerFactory.getLogger(MapDSchema.class);
33 
34  final private MetaConnect metaConnect;
36  public MapDSchema(String dataDir,
37  MapDParser mp,
38  int mapdPort,
39  MapDUser mapdUser,
41  System.setProperty(
42  "saffron.default.charset", ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
43  System.setProperty(
44  "saffron.default.nationalcharset", ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
45  System.setProperty("saffron.default.collation.name",
46  ConversionUtil.NATIVE_UTF16_CHARSET_NAME + "$en_US");
47  metaConnect = new MetaConnect(mapdPort, dataDir, mapdUser, mp, skT);
48  }
49 
50  @Override
51  public Table getTable(String string) {
52  Table table = metaConnect.getTable(string);
53  return table;
54  }
55 
56  @Override
57  public Set<String> getTableNames() {
58  Set<String> tableSet = metaConnect.getTables();
59  return tableSet;
60  }
61 
62  @Override
63  public Collection<Function> getFunctions(String string) {
64  Collection<Function> functionCollection = new HashSet<Function>();
65  return functionCollection;
66  }
67 
68  @Override
69  public Set<String> getFunctionNames() {
70  Set<String> functionSet = new HashSet<String>();
71  return functionSet;
72  }
73 
74  @Override
75  public Schema getSubSchema(String string) {
76  return null;
77  }
78 
79  @Override
80  public Set<String> getSubSchemaNames() {
81  Set<String> hs = new HashSet<String>();
82  return hs;
83  }
84 
85  @Override
86  public Expression getExpression(SchemaPlus sp, String string) {
87  throw new UnsupportedOperationException("Not supported yet.");
88  }
89 
90  @Override
91  public boolean isMutable() {
92  throw new UnsupportedOperationException("Not supported yet.");
93  }
94 
95  void updateMetaData(String schema, String table) {
96  metaConnect.updateMetaData(schema, table);
97  }
98 
99  @Override
100  public Schema snapshot(SchemaVersion sv) {
101  throw new UnsupportedOperationException("Not supported yet.");
102  }
103 
104  @Override
105  public RelProtoDataType getType(String arg0) {
106  throw new UnsupportedOperationException("Not supported yet.");
107  }
108 
109  @Override
110  public Set<String> getTypeNames() {
111  throw new UnsupportedOperationException("Not supported yet.");
112  }
113 }
Collection< Function > getFunctions(String string)
Definition: MapDSchema.java:63
void updateMetaData(String schema, String table)
Definition: MapDSchema.java:95
static final Logger MAPDLOGGER
Definition: MapDSchema.java:32
Expression getExpression(SchemaPlus sp, String string)
Definition: MapDSchema.java:86
Table getTable(String string)
Definition: MapDSchema.java:51
Schema snapshot(SchemaVersion sv)
SockTransportProperties sock_transport_properties
Definition: MapDSchema.java:35
Schema getSubSchema(String string)
Definition: MapDSchema.java:75
RelProtoDataType getType(String arg0)
MapDSchema(String dataDir, MapDParser mp, int mapdPort, MapDUser mapdUser, SockTransportProperties skT)
Definition: MapDSchema.java:36