OmniSciDB  a5dc49c757
 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

Definition at line 46 of file tester.java.

Member Function Documentation

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

Definition at line 49 of file tester.java.

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

Member Data Documentation

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

Definition at line 47 of file tester.java.


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