50 final SqlStdOperatorTable stdOpTab = SqlStdOperatorTable.instance();
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)
67 Planner p = Frameworks.getPlanner(config);
69 SqlNode parseR = null;
71 parseR = p.parse(
"<<QUERY>>");
72 }
catch (SqlParseException ex) {
73 Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
76 SqlNode validateR = null;
79 }
catch (ValidationException ex) {
80 Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
84 relR = p.rel(validateR);
85 }
catch (RelConversionException ex) {
86 Logger.getLogger(tester.class.getName()).log(Level.SEVERE, null, ex);
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()));
94 Supplier<HeavyDBSqlOperatorTable> operatorTable =
95 new Supplier<HeavyDBSqlOperatorTable>() {
97 public HeavyDBSqlOperatorTable
get() {
98 return new HeavyDBSqlOperatorTable(SqlStdOperatorTable.instance());
101 HeavyDBParser mp =
new HeavyDBParser(
"<<PATH_TO_DATA_DIR>>", operatorTable, -1, null);
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);