OmniSciDB  1dac507f6e
 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 33 of file tester.java.

Member Function Documentation

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

Definition at line 36 of file tester.java.

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

Member Data Documentation

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

Definition at line 34 of file tester.java.


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