-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from Functor10/master
Add qsql 0.6 related features.
- Loading branch information
Showing
110 changed files
with
2,617 additions
and
1,278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,8 @@ nbbuild/ | |
nbdist/ | ||
.nb-gradle/ | ||
|
||
/log/ | ||
### Sqlite ### | ||
*-journal | ||
|
||
/log/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
...he/calcite/adapter/mysql/MySQLSchema.java → ...he/calcite/adapter/custom/JdbcSchema.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package org.apache.calcite.adapter.mysql; | ||
|
||
import org.apache.calcite.schema.impl.AbstractSchema; | ||
|
||
//TODO reduce all of default schemas like this which has no field and param | ||
public class MySQLSchema extends AbstractSchema { | ||
public MySQLSchema() {} | ||
} | ||
package org.apache.calcite.adapter.custom; | ||
|
||
import org.apache.calcite.schema.impl.AbstractSchema; | ||
|
||
//TODO reduce all of default schemas like this which has no field and param | ||
public class JdbcSchema extends AbstractSchema { | ||
public JdbcSchema() {} | ||
} |
38 changes: 19 additions & 19 deletions
38
...ite/adapter/mysql/MySQLSchemaFactory.java → ...ite/adapter/custom/JdbcSchemaFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package org.apache.calcite.adapter.mysql; | ||
|
||
import org.apache.calcite.schema.Schema; | ||
import org.apache.calcite.schema.SchemaFactory; | ||
import org.apache.calcite.schema.SchemaPlus; | ||
|
||
import java.util.Map; | ||
|
||
public class MySQLSchemaFactory implements SchemaFactory { | ||
|
||
public static final MySQLSchemaFactory INSTANCE = new MySQLSchemaFactory(); | ||
|
||
private MySQLSchemaFactory() {} | ||
|
||
@Override | ||
public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { | ||
return new MySQLSchema(); | ||
} | ||
} | ||
package org.apache.calcite.adapter.custom; | ||
|
||
import org.apache.calcite.schema.Schema; | ||
import org.apache.calcite.schema.SchemaFactory; | ||
import org.apache.calcite.schema.SchemaPlus; | ||
|
||
import java.util.Map; | ||
|
||
public class JdbcSchemaFactory implements SchemaFactory { | ||
|
||
public static final JdbcSchemaFactory INSTANCE = new JdbcSchemaFactory(); | ||
|
||
private JdbcSchemaFactory() {} | ||
|
||
@Override | ||
public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { | ||
return new JdbcSchema(); | ||
} | ||
} |
130 changes: 67 additions & 63 deletions
130
...che/calcite/adapter/mysql/MySQLTable.java → ...che/calcite/adapter/custom/JdbcTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,67 @@ | ||
package org.apache.calcite.adapter.mysql; | ||
|
||
import org.apache.calcite.plan.RelOptCluster; | ||
import org.apache.calcite.plan.RelOptTable; | ||
import org.apache.calcite.rel.RelNode; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
import org.apache.calcite.rel.type.RelDataTypeFactory; | ||
import org.apache.calcite.schema.TranslatableTable; | ||
import org.apache.calcite.schema.impl.AbstractTable; | ||
|
||
import java.util.Properties; | ||
|
||
public class MySQLTable extends AbstractTable implements TranslatableTable { | ||
public final String jdbcDriver; | ||
public final String jdbcUrl; | ||
public final String jdbcUser; | ||
public final String jdbcPassword; | ||
public final String tableName; | ||
public final String modelUri; | ||
public final String dbName; | ||
|
||
public Properties properties; | ||
|
||
public Properties getProperties() { | ||
return properties; | ||
} | ||
|
||
MySQLTable(String tableName, String dbName, | ||
String driver, String url, String user, | ||
String password, String modelUri) { | ||
this.modelUri = modelUri; | ||
this.jdbcDriver = driver; | ||
this.jdbcUrl = url; | ||
this.jdbcUser = user; | ||
this.jdbcPassword = password; | ||
this.tableName = tableName; | ||
this.dbName = dbName; | ||
|
||
this.properties = new Properties(); | ||
properties.put("jdbcDriver", driver); | ||
properties.put("jdbcUrl", url); | ||
properties.put("jdbcUser", user); | ||
properties.put("jdbcPassword", password); | ||
properties.put("tableName", tableName); | ||
properties.put("dbName", dbName); | ||
} | ||
|
||
@Override | ||
public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable) { | ||
final RelOptCluster cluster = context.getCluster(); | ||
return new MySQLTableScan(cluster, cluster.traitSet(), relOptTable); | ||
} | ||
|
||
@Override | ||
public String getBaseName() { | ||
return dbName; | ||
} | ||
|
||
@Override | ||
public RelDataType getRowType(RelDataTypeFactory typeFactory) { | ||
return super.getRowType(modelUri, dbName, tableName, typeFactory); | ||
} | ||
} | ||
package org.apache.calcite.adapter.custom; | ||
|
||
import org.apache.calcite.plan.RelOptCluster; | ||
import org.apache.calcite.plan.RelOptTable; | ||
import org.apache.calcite.rel.RelNode; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
import org.apache.calcite.rel.type.RelDataTypeFactory; | ||
import org.apache.calcite.schema.TranslatableTable; | ||
import org.apache.calcite.schema.impl.AbstractTable; | ||
|
||
import java.util.Properties; | ||
|
||
public class JdbcTable extends AbstractTable implements TranslatableTable { | ||
public final String jdbcDriver; | ||
public final String jdbcUrl; | ||
public final String jdbcUser; | ||
public final String jdbcPassword; | ||
public final String tableName; | ||
public final String modelUri; | ||
public final String dbName; | ||
public final String dbType; | ||
|
||
|
||
public Properties properties; | ||
|
||
public Properties getProperties() { | ||
return properties; | ||
} | ||
|
||
JdbcTable(String tableName, String dbName, | ||
String driver, String url, String user, | ||
String password, String modelUri, String dbType) { | ||
this.modelUri = modelUri; | ||
this.jdbcDriver = driver; | ||
this.jdbcUrl = url; | ||
this.jdbcUser = user; | ||
this.jdbcPassword = password; | ||
this.tableName = tableName; | ||
this.dbName = dbName; | ||
this.dbType = dbType; | ||
|
||
this.properties = new Properties(); | ||
properties.put("jdbcDriver", driver); | ||
properties.put("jdbcUrl", url); | ||
properties.put("jdbcUser", user); | ||
properties.put("jdbcPassword", password); | ||
properties.put("tableName", tableName); | ||
properties.put("dbName", dbName); | ||
properties.put("dbType", dbType); | ||
} | ||
|
||
@Override | ||
public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable) { | ||
final RelOptCluster cluster = context.getCluster(); | ||
return new JdbcTableScan(cluster, cluster.traitSet(), relOptTable); | ||
} | ||
|
||
@Override | ||
public String getBaseName() { | ||
return dbName; | ||
} | ||
|
||
@Override | ||
public RelDataType getRowType(RelDataTypeFactory typeFactory) { | ||
return super.getRowType(modelUri, dbName, tableName, typeFactory); | ||
} | ||
} |
53 changes: 27 additions & 26 deletions
53
...cite/adapter/mysql/MySQLTableFactory.java → ...cite/adapter/custom/JdbcTableFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
package org.apache.calcite.adapter.mysql; | ||
|
||
import org.apache.calcite.rel.type.RelDataType; | ||
import org.apache.calcite.schema.SchemaPlus; | ||
import org.apache.calcite.schema.Table; | ||
import org.apache.calcite.schema.TableFactory; | ||
|
||
import java.util.Map; | ||
|
||
public class MySQLTableFactory implements TableFactory { | ||
|
||
@Override | ||
public Table create(SchemaPlus schema, String name, Map operand, RelDataType rowType) { | ||
String tableName = operand.get("tableName").toString(); | ||
String dbName = operand.get("dbName").toString(); | ||
String jdbcUrl = operand.get("jdbcUrl").toString(); | ||
String jdbcUser = operand.get("jdbcUser").toString(); | ||
String jdbcPassword = operand.get("jdbcPassword").toString(); | ||
String jdbcDriver = operand.get("jdbcDriver").toString(); | ||
String modelUri = operand.get("modelUri").toString(); | ||
|
||
return new MySQLTable(tableName, dbName, | ||
jdbcDriver, jdbcUrl, | ||
jdbcUser, jdbcPassword, | ||
modelUri); | ||
} | ||
package org.apache.calcite.adapter.custom; | ||
|
||
import org.apache.calcite.rel.type.RelDataType; | ||
import org.apache.calcite.schema.SchemaPlus; | ||
import org.apache.calcite.schema.Table; | ||
import org.apache.calcite.schema.TableFactory; | ||
|
||
import java.util.Map; | ||
|
||
public class JdbcTableFactory implements TableFactory { | ||
|
||
@Override | ||
public Table create(SchemaPlus schema, String name, Map operand, RelDataType rowType) { | ||
String tableName = operand.get("tableName").toString(); | ||
String dbName = operand.get("dbName").toString(); | ||
String jdbcUrl = operand.get("jdbcUrl").toString(); | ||
String jdbcUser = operand.get("jdbcUser").toString(); | ||
String jdbcPassword = operand.get("jdbcPassword").toString(); | ||
String jdbcDriver = operand.get("jdbcDriver").toString(); | ||
String modelUri = operand.get("modelUri").toString(); | ||
String dbType = operand.get("dbType").toString(); | ||
|
||
return new JdbcTable(tableName, dbName, | ||
jdbcDriver, jdbcUrl, | ||
jdbcUser, jdbcPassword, | ||
modelUri, dbType); | ||
} | ||
} |
26 changes: 13 additions & 13 deletions
26
...calcite/adapter/mysql/MySQLTableScan.java → ...calcite/adapter/custom/JdbcTableScan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package org.apache.calcite.adapter.mysql; | ||
|
||
import org.apache.calcite.plan.RelOptCluster; | ||
import org.apache.calcite.plan.RelOptTable; | ||
import org.apache.calcite.plan.RelTraitSet; | ||
import org.apache.calcite.rel.core.TableScan; | ||
|
||
public class MySQLTableScan extends TableScan { | ||
|
||
protected MySQLTableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table) { | ||
super(cluster, traitSet, table); | ||
} | ||
} | ||
package org.apache.calcite.adapter.custom; | ||
|
||
import org.apache.calcite.plan.RelOptCluster; | ||
import org.apache.calcite.plan.RelOptTable; | ||
import org.apache.calcite.plan.RelTraitSet; | ||
import org.apache.calcite.rel.core.TableScan; | ||
|
||
public class JdbcTableScan extends TableScan { | ||
|
||
protected JdbcTableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table) { | ||
super(cluster, traitSet, table); | ||
} | ||
} |
Oops, something went wrong.