Skip to content

Commit

Permalink
[CALCITE-1959] Reduce the amount of metadata and tableName calls in D…
Browse files Browse the repository at this point in the history
…ruid (Zain Humayun)

* Update javadocs
* Use correct create method in getTableMap
  • Loading branch information
Zain Humayun authored and jcamachor committed Aug 25, 2017
1 parent 9ab47c0 commit b0ae502
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public DruidSchema(String url, String coordinatorUrl,

return DruidTable.create(DruidSchema.this, tableName, null,
fieldMap, metricNameSet, DruidTable.DEFAULT_TIMESTAMP_COLUMN,
connection, complexMetrics);
complexMetrics);
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ public DruidTable(DruidSchema schema, String dataSource,
: ImmutableMap.copyOf(allFields);
}

/** Creates a {@link DruidTable}
/** Creates a {@link DruidTable} by using the given {@link DruidConnectionImpl}
* to populate the other parameters. The parameters may be partially populated.
*
* @param druidSchema Druid schema
* @param dataSourceName Data source name in Druid, also table name
* @param intervals Intervals, or null to use default
* @param fieldMap Mutable map of fields (dimensions plus metrics);
* may be partially populated already
* @param metricNameSet Mutable set of metric names;
* may be partially populated already
* @param fieldMap Partially populated map of fields (dimensions plus metrics)
* @param metricNameSet Partially populated set of metric names
* @param timestampColumnName Name of timestamp column, or null
* @param connection connection used to find column definitions. Must be non-null.
* @param connection Connection used to find column definitions; Must be non-null
* @param complexMetrics List of complex metrics in Druid (thetaSketch, hyperUnique)
*
* @return A table
*/
Expand All @@ -118,16 +118,16 @@ static Table create(DruidSchema druidSchema, String dataSourceName,
metricNameSet, timestampColumnName, complexMetrics);
}

/** Creates a {@link DruidTable}
/** Creates a {@link DruidTable} by copying the given parameters.
*
* @param druidSchema Druid schema
* @param dataSourceName Data source name in Druid, also table name
* @param intervals Intervals, or null to use default
* @param fieldMap Mutable map of fields (dimensions plus metrics);
* may be partially populated already
* @param metricNameSet Mutable set of metric names;
* may be partially populated already
* @param fieldMap Fully populated map of fields (dimensions plus metrics)
* @param metricNameSet Fully populated set of metric names
* @param timestampColumnName Name of timestamp column, or null
* @param complexMetrics List of complex metrics in Druid (thetaSketch, hyperUnique)
*
* @return A table
*/
static Table create(DruidSchema druidSchema, String dataSourceName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -3191,7 +3192,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe
* */
@Test public void testTableMapReused() {
AbstractSchema schema = new DruidSchema("http://localhost:8082", "http://localhost:8081", true);
assert schema.getTable("wikiticker") == schema.getTable("wikiticker");
assertSame(schema.getTable("wikiticker"), schema.getTable("wikiticker"));
}
}

Expand Down

0 comments on commit b0ae502

Please sign in to comment.