OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 HEAVYDBLOGGER = LoggerFactory.getLogger(tester.class)
 

Detailed Description

Author
michael

Definition at line 50 of file tester.java.

Member Function Documentation

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

Definition at line 53 of file tester.java.

53  {
54  final SqlStdOperatorTable stdOpTab = SqlStdOperatorTable.instance();
55 
56  HeavyDBUser mdu = new HeavyDBUser("admin", "passwd", "omnisci", -1, null);
57  HeavyDBSchema dbSchema =
58  new HeavyDBSchema("<<PATH_TO_DATA_DIR>>", null, -1, mdu, null);
59  final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
60  final FrameworkConfig config =
61  Frameworks.newConfigBuilder()
62  .defaultSchema(rootSchema.add("omnisci", dbSchema))
63  .operatorTable(stdOpTab)
64  .parserConfig(SqlParser.configBuilder()
65  .setConformance(SqlConformanceEnum.LENIENT)
66  .setUnquotedCasing(Casing.UNCHANGED)
67  .setCaseSensitive(false)
68  .build())
69  .build();
70 
71  Planner p = Frameworks.getPlanner(config);
72 
73  SqlNode parseR = null;
74  try {
75  parseR = p.parse("<<QUERY>>");
76  } catch (SqlParseException ex) {
77  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
78  }
79 
80  SqlNode validateR = null;
81  try {
82  p.validate(parseR);
83  } catch (ValidationException ex) {
84  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
85  }
86  RelRoot relR = null;
87  try {
88  relR = p.rel(validateR);
89  } catch (RelConversionException ex) {
90  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
91  }
92  HEAVYDBLOGGER.error("Result was " + relR);
93  HEAVYDBLOGGER.error("Result project() " + relR.project());
94  HEAVYDBLOGGER.error("Result project() " + RelOptUtil.toString(relR.project()));
95  HEAVYDBLOGGER.error("Json Version \n" + HeavyDBSerializer.toString(relR.project()));
96 
97  // now do with HeavyDB parser
98  Supplier<HeavyDBSqlOperatorTable> operatorTable =
99  new Supplier<HeavyDBSqlOperatorTable>() {
100  @Override
101  public HeavyDBSqlOperatorTable get() {
102  return new HeavyDBSqlOperatorTable(SqlStdOperatorTable.instance());
103  }
104  };
105  HeavyDBParser mp = new HeavyDBParser("<<PATH_TO_DATA_DIR>>", operatorTable, -1, null);
106  mp.setUser(mdu);
107 
108  try {
109  HeavyDBParserOptions mdpo = new HeavyDBParserOptions();
110  HEAVYDBLOGGER.error("HeavyDBParser result: \n" + mp.processSql("<<QUERY>>", mdpo));
111  } catch (SqlParseException ex) {
112  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
113  } catch (ValidationException ex) {
114  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
115  } catch (RelConversionException ex) {
116  Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
117  }
118  }

Member Data Documentation

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

Definition at line 51 of file tester.java.


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