OmniSciDB  fe05a0c208
 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 37 of file tester.java.

Member Function Documentation

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

Definition at line 40 of file tester.java.

40  {
41  final SqlStdOperatorTable stdOpTab = SqlStdOperatorTable.instance();
42 
43  MapDUser mdu = new MapDUser("admin", "passwd", "omnisci", -1, null);
44  MapDSchema mapd = new MapDSchema("<<PATH_TO_DATA_DIR>>", null, -1, mdu, null);
45  final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
46  final FrameworkConfig config =
47  Frameworks.newConfigBuilder()
48  .defaultSchema(rootSchema.add("omnisci", mapd))
49  .operatorTable(stdOpTab)
50  .parserConfig(SqlParser.configBuilder()
51  .setConformance(SqlConformanceEnum.LENIENT)
52  .setUnquotedCasing(Casing.UNCHANGED)
53  .setCaseSensitive(false)
54  .build())
55  .build();
56 
57  Planner p = Frameworks.getPlanner(config);
58 
59  SqlNode parseR = null;
60  try {
61  parseR = p.parse("<<QUERY>>");
62  } catch (SqlParseException ex) {
63  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
64  }
65 
66  SqlNode validateR = null;
67  try {
68  p.validate(parseR);
69  } catch (ValidationException ex) {
70  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
71  }
72  RelRoot relR = null;
73  try {
74  relR = p.rel(validateR);
75  } catch (RelConversionException ex) {
76  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
77  }
78  MAPDLOGGER.error("Result was " + relR);
79  MAPDLOGGER.error("Result project() " + relR.project());
80  MAPDLOGGER.error("Result project() " + RelOptUtil.toString(relR.project()));
81  MAPDLOGGER.error("Json Version \n" + MapDSerializer.toString(relR.project()));
82 
83  // now do with MapD parser
84  Supplier<MapDSqlOperatorTable> operatorTable = new Supplier<MapDSqlOperatorTable>() {
85  @Override
86  public MapDSqlOperatorTable get() {
87  return new MapDSqlOperatorTable(SqlStdOperatorTable.instance());
88  }
89  };
90  MapDParser mp = new MapDParser("<<PATH_TO_DATA_DIR>>", operatorTable, -1, null);
91  mp.setUser(mdu);
92 
93  try {
94  MapDParserOptions mdpo = new MapDParserOptions();
95  MAPDLOGGER.error("MapDParser result: \n" + mp.processSql("<<QUERY>>", mdpo));
96  } catch (SqlParseException ex) {
97  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
98  } catch (ValidationException ex) {
99  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
100  } catch (RelConversionException ex) {
101  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
102  }
103  }

Member Data Documentation

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

Definition at line 38 of file tester.java.


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