OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.mapd.calcite.planner.tester Class Reference
+ Collaboration diagram for com.mapd.calcite.planner.tester:

Static Public Member Functions

static void main (String[] args)
 

Static Package Attributes

static final org.slf4j.Logger MAPDLOGGER = LoggerFactory.getLogger(tester.class)
 

Detailed Description

Author
michael

Definition at line 32 of file tester.java.

Member Function Documentation

static void com.mapd.calcite.planner.tester.main ( String[]  args)
inlinestatic

Definition at line 35 of file tester.java.

35  {
36  final SqlStdOperatorTable stdOpTab = SqlStdOperatorTable.instance();
37  // SqlOperatorTable opTab =
38  // ChainedSqlOperatorTable.of(stdOpTab,
39  // new ListSqlOperatorTable(
40  // ImmutableList.<SqlOperator>of(new MyCountAggFunction())));
41  MapDUser mdu = new MapDUser("admin", "passwd", "catalog", -1);
42  MapDSchema mapd =
43  new MapDSchema("/home/michael/mapd2/build/data", null, -1, mdu, null);
44  final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
45  final FrameworkConfig config = Frameworks.newConfigBuilder()
46  .defaultSchema(rootSchema.add("omnisci", mapd))
47  .operatorTable(stdOpTab)
48  .build();
49 
50  Planner p = Frameworks.getPlanner(config);
51 
52  SqlNode parseR = null;
53  try {
54  parseR = p.parse("select * from customer where c_custkey = 1.345000 limit 5");
55  } catch (SqlParseException ex) {
56  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
57  }
58 
59  SqlNode validateR = null;
60  try {
61  p.validate(parseR);
62  } catch (ValidationException ex) {
63  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
64  }
65  RelRoot relR = null;
66  try {
67  relR = p.rel(validateR);
68  } catch (RelConversionException ex) {
69  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
70  }
71  MAPDLOGGER.error("Result was " + relR);
72  MAPDLOGGER.error("Result project() " + relR.project());
73  MAPDLOGGER.error("Result project() " + RelOptUtil.toString(relR.project()));
74  MAPDLOGGER.error("Json Version \n" + MapDSerializer.toString(relR.project()));
75 
76  // now do with MapD parser
77  MapDParser mp = new MapDParser("/home/michael/mapd2/build/data", null, -1, null);
78  mp.setUser(mdu);
79 
80  try {
81  MapDParserOptions mdpo = new MapDParserOptions();
82  MAPDLOGGER.error("MapDParser result: \n"
83  + mp.processSql(
84  "select * from customer where c_custkey = 1.345000 limit 5", mdpo));
85  } catch (SqlParseException ex) {
86  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
87  } catch (ValidationException ex) {
88  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
89  } catch (RelConversionException ex) {
90  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
91  }
92  }

Member Data Documentation

final org.slf4j.Logger com.mapd.calcite.planner.tester.MAPDLOGGER = LoggerFactory.getLogger(tester.class)
staticpackage

Definition at line 33 of file tester.java.


The documentation for this class was generated from the following file: