Github user LosD commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/165#discussion_r148126432
--- Diff:
core/src/main/java/org/apache/metamodel/QueryPostprocessDataContext.java ---
@@ -63,24 +64,29 @@
import org.slf4j.LoggerFactory;
/**
- * Abstract DataContext for data sources that do not support SQL queries
- * natively.
+ * Abstract DataContext for data sources that do not support SQL queries
natively.
*
- * Instead this superclass only requires that a subclass can materialize a
- * single table at a time. Then the query will be executed by post
processing
- * the datasets client-side.
+ * Instead this superclass only requires that a subclass can materialize a
single table at a time. Then the query will
+ * be executed by post processing the datasets client-side.
*/
public abstract class QueryPostprocessDataContext extends
AbstractDataContext implements HasReadTypeConverters {
private static final Logger logger =
LoggerFactory.getLogger(QueryPostprocessDataContext.class);
+ public static final String SYSTEM_PROPERTY_CREATE_DEFAULT_TABLE_ALIAS
= "metamodel.alias.default.table";
public static final String INFORMATION_SCHEMA_NAME =
"information_schema";
- private final Map<Column, TypeConverter<?, ?>> _converters;
+ private final Map<Column, TypeConverter<?, ?>> converters;
+ private final boolean defaultTableEnabled;
public QueryPostprocessDataContext() {
+ this(true);
+ }
+
+ public QueryPostprocessDataContext(boolean defaultTableEnabled) {
--- End diff --
I'd maybe consider another argument and field name, like
`singleTableDatastore`. The current name creates an obligation to have a
default table, while `singleTableDatastore` would allow tweaking what actually
happens in the situation (e.g. if we opt for context flags, like suggested in
#128).
I guess a `singleTableDatastore` flag would also allow us to implement
optimizations/simplifications later, as we know what to expect. We could also
enforce the single table, and maybe save a context developer from surprises and
headaches :).
---