OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  String db) {
42  System.setProperty(
43  "saffron.default.charset", ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
44  System.setProperty(
45  "saffron.default.nationalcharset", ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
46  System.setProperty("saffron.default.collation.name",
47  ConversionUtil.NATIVE_UTF16_CHARSET_NAME + "$en_US");
48  metaConnect = new MetaConnect(mapdPort, dataDir, mapdUser, mp, skT, db);
49  }
50 
51  public MapDSchema(String dataDir,
52  MapDParser mp,
53  int mapdPort,
54  MapDUser mapdUser,
56  this(dataDir, mp, mapdPort, mapdUser, skT, null);
57  }
58 
59  @Override
60  public Table getTable(String string) {
61  Table table = metaConnect.getTable(string);
62  return table;
63  }
64 
65  @Override
66  public Set<String> getTableNames() {
67  Set<String> tableSet = metaConnect.getTables();
68  return tableSet;
69  }
70 
71  @Override
72  public Collection<Function> getFunctions(String string) {
73  Collection<Function> functionCollection = new HashSet<Function>();
74  return functionCollection;
75  }
76 
77  @Override
78  public Set<String> getFunctionNames() {
79  Set<String> functionSet = new HashSet<String>();
80  return functionSet;
81  }
82 
83  @Override
84  public Schema getSubSchema(String string) {
85  return null;
86  }
87 
88  @Override
89  public Set<String> getSubSchemaNames() {
90  Set<String> hs = new HashSet<String>();
91  return hs;
92  }
93 
94  @Override
95  public Expression getExpression(SchemaPlus sp, String string) {
96  throw new UnsupportedOperationException("Not supported yet.");
97  }
98 
99  @Override
100  public boolean isMutable() {
101  throw new UnsupportedOperationException("Not supported yet.");
102  }
103 
104  void updateMetaData(String schema, String table) {
105  metaConnect.updateMetaData(schema, table);
106  }
107 
108  @Override
109  public Schema snapshot(SchemaVersion sv) {
110  throw new UnsupportedOperationException("Not supported yet.");
111  }
112 
113  @Override
114  public RelProtoDataType getType(String arg0) {
115  throw new UnsupportedOperationException("Not supported yet.");
116  }
117 
118  @Override
119  public Set<String> getTypeNames() {
120  throw new UnsupportedOperationException("Not supported yet.");
121  }
122 }
MapDSchema(String dataDir, MapDParser mp, int mapdPort, MapDUser mapdUser, SockTransportProperties skT, String db)
Definition: MapDSchema.java:36
Collection< Function > getFunctions(String string)
Definition: MapDSchema.java:72
void updateMetaData(String schema, String table)
static final Logger MAPDLOGGER
Definition: MapDSchema.java:32
Expression getExpression(SchemaPlus sp, String string)
Definition: MapDSchema.java:95
Table getTable(String string)
Definition: MapDSchema.java:60
Schema snapshot(SchemaVersion sv)
SockTransportProperties sock_transport_properties
Definition: MapDSchema.java:35
Schema getSubSchema(String string)
Definition: MapDSchema.java:84
RelProtoDataType getType(String arg0)
MapDSchema(String dataDir, MapDParser mp, int mapdPort, MapDUser mapdUser, SockTransportProperties skT)
Definition: MapDSchema.java:51