Skip to content

Commit 6adc8b7

Browse files
Andrew Cholewamichael-mclawhorn
authored andcommitted
Improves Dimension::getFieldByName documentation
-- The `ApiFilter` constructor relies on the fact that `Dimension::getFieldByName` throws an `IllegalArgumentException` to perform validation. However, that is not documented on the `Dimension` interface, which may lead implementors of `Dimension` to erroneously assume that returning `null` is valid if a `DimensionField` is not found (which is common for this kind of method). However, what actually happens is that the `ApiFilter` is constructed with a `null` field, leading to a `NullPointerException` at some point later.` -- So the documentation on `Dimension` is updated to make that explicit.
1 parent 9b6b5d0 commit 6adc8b7

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

CHANGELOG.md

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Change Log
22
==========
33

4-
All notable changes to Fili will be documented here. Changes are accumulated as new paragraphs at the top of the current
4+
All notable changes to Fili will be documented here. Changes are accumulated as new paragraphs at the top of the current
55
major version. Each change has a link to the pull request that makes the change and to the issue that triggered the
66
pull request if there was one.
77

@@ -10,18 +10,20 @@ Current
1010

1111
### Added:
1212

13+
- [Documentation that `Dimension::getFieldByName` should throw an `IllegalArgumentException` if there is no field with the passed in name](https://github.com/yahoo/fili/pull/547)
14+
1315
- [Evaluate format type from both URI and Accept header](https://github.com/yahoo/fili/pull/495)
1416
* Add a new functional interface `ResponseFormatResolver` to coalesce Accept header format type and URI format type.
1517
* Implement a concrete implementation of `ResponseFormatResolver` in `AbstractBindingFactory`.
16-
18+
1719
- [Add Constructor and wither for TableApiRequest](https://github.com/yahoo/fili/pull/539)
18-
* Making the TablesApiRequest similar to other ApiRequest classses so added an all argument constructor
19-
and withers. The all argument constructor is made private since its used only by the withers.
20-
20+
* Making the TablesApiRequest similar to other ApiRequest classses so added an all argument constructor
21+
and withers. The all argument constructor is made private since its used only by the withers.
22+
2123
- [Add Code Narc to validate Groovy style](https://github.com/yahoo/fili/pull/420)
2224
* Checkstyle is great, but it doesn't process Groovy. Code Narc is Checkstyle for Groovy, so we should totally use
2325
it.
24-
26+
2527
- [Allow Webservice to Configure Metric Long Name](https://github.com/yahoo/fili/pull/492)
2628
* Logical metric needs more config-richness to not just configure metric name, but also metric long name,
2729
description, etc. MetricInstance is now created by accepting a LogicalMetricInfo which contains all these fields
@@ -40,10 +42,10 @@ Current
4042
* Part of Fili translation in order to increase popularity of Fili in Chinese tech industries.
4143

4244
- [Add Uptime Status Metric](https://github.com/yahoo/fili/pull/518)
43-
* Add a metric to show how long Fili has been running
45+
* Add a metric to show how long Fili has been running
4446

4547
- [Add `druid_broker` config parameter to replace `ui_druid_broker` and `non_ui_druid_broker`](https://github.com/yahoo/fili/pull/489)
46-
48+
4749
- [Have Tables Endpoint Support (but not use) Additional Query Parameters](https://github.com/yahoo/fili/pull/437)
4850
* Make the availability consider the TablesApiRequest by passing it into the getLogicalTableFullView method
4951
* Move auxiliary methods from `DataApiRequest` to `ApiRequest` in order to make them sharable between
@@ -87,7 +89,7 @@ Current
8789

8890
- [Rename filter variables and methods in DataApiRequest](https://github.com/yahoo/fili/pull/507)
8991
* The method names `getFilter` and `getFilters` can be confusing, as well as the `filters` variable
90-
92+
9193
- [Decoupled from static dimension lookup building]()
9294
* Instead of `ModelUtils`, create an interface for `ExtractionFunctionDimension` and rebase `LookupDimension` and `RegisteredLookupDimension` on that interface.
9395
* `LookupDimensionToDimensionSpec` now uses only the Extraction interface to decide how to serialize dimensions.
@@ -147,7 +149,7 @@ Current
147149

148150
- [Fix ConstantMaker make method with LogicalMetricInfo class](https://github.com/yahoo/fili/pull/540)
149151
* The ConstantMaker make method needs to be rewritten with the LogicalMetricInfo class.
150-
152+
151153
- [Slices endpoint returns druid name instead of api name](https://github.com/yahoo/fili/pull/491)
152154
* The slices endpoint now gives the druid name instead of the api name for dimensions.
153155

@@ -156,7 +158,7 @@ Current
156158
classes results in `NullPointerException` and fails tests, because some instance variables from testing [`DataApiRequest`](./fili-core/src/main/java/com/yahoo/bard/webservice/web/DataApiRequest.java)
157159
are null. This patch assigns non-null values to those variables.
158160
* The testing constructor `DataApiRequestImpl()` is now deprecated and will be removed entirely.
159-
161+
160162
- [Fix Lucene Cardinality in New KeyValueStores](https://github.com/yahoo/fili/pull/521)
161163
* Fix lucene to put correct cardinality value to new key value store that does not contain the cardinality key
162164

@@ -190,7 +192,7 @@ Current
190192
* Reverting the PR-419(https://github.com/yahoo/fili/pull/419) so that the name still points to apiName and added factName which points to druidName.
191193
`name` was not valid for cases when it is a Lookup dimension because it was pointing to the base dimension name , so reverted that change and added
192194
`druidName` which is the actual druid fact name and `name` being the apiName
193-
195+
194196
- [Remove custom immutable collections in favor of Guava](https://github.com/yahoo/fili/pull/479)
195197
* `Utils.makeImmutable(...)` was misleading and uneeded so it has been removed. Use Guava's immutable collections.
196198

@@ -431,7 +433,7 @@ Removals:
431433
* Bound and default versions of getAvailableIntervals and getAllAvailableIntervals added to PhysicalTable interface
432434
* Package-private optimize tests in `DruidQueryBuilder` moved to protected
433435
* Immutable `NoVolatileIntervalsFunction` class made final
434-
436+
435437
- [Moved UnionDataSource to support only single tables](https://github.com/yahoo/fili/pull/262)
436438
* `UnionDataSource` now accepts only single tables instead of sets of tables.
437439
* `DataSource` now supports `getDataSource()` operation
@@ -510,7 +512,7 @@ Removals:
510512
* `TableLoader` now takes an additional constructor argument (`DataSourceMetadataService`) for creating tables
511513
* `PartialDataHandler::findMissingRequestTimeGrainIntervals` now takes `DataSourceConstraint`
512514
* Renamed `buildTableGroup` method to `buildDimensionSpanningTableGroup`
513-
515+
514516
- [Restored flexibility about columns for query from DruidResponseParser](https://github.com/yahoo/fili/pull/198)
515517
* Immutable schemas prevented custom query types from changing `ResultSetSchema` columns.
516518
* Columns are now sourced from `DruidResponseParser` and default implemented on `DruidAggregationQuery`
@@ -680,7 +682,7 @@ Removals:
680682
- [Fixed `SegmentMetadataLoader` Unconfigured Dimension Bug](https://github.com/yahoo/fili/pull/197)
681683
* Immutable availability was failing when attempting to bind segment dimension columns not configured in the
682684
dimension dictionary.
683-
* Fix to filter irrelevant column names.
685+
* Fix to filter irrelevant column names.
684686

685687
- [Major refactor for availability and schemas and tables](https://github.com/yahoo/fili/pull/165)
686688
* Ordering of fields on serialization could be inconsistent if intermediate stages used `HashSet` or `HashMap`.
@@ -806,8 +808,8 @@ Changes:
806808
### Changed:
807809

808810
- [The druid query posting timer has been removed](https://github.com/yahoo/fili/pull/141)
809-
* There wasn't really a good way of stopping timing only the posting itself. Since the timer is
810-
probably not that useful, it has been removed.
811+
* There wasn't really a good way of stopping timing only the posting itself. Since the timer is
812+
probably not that useful, it has been removed.
811813

812814
- [Dimension Field Tagging and Dynamic Dimension Field Serilization](https://github.com/yahoo/fili/pull/137)
813815
* Changed `fili-core` dimension endpoint `DimensionField` serialization strategy from hard coded static attributes
@@ -853,7 +855,7 @@ Changes:
853855
* `Response.StatusType` is the interface that `Response.Status` implements.
854856
* This will have no impact on current code in Fili that uses `ResponseValidationException`, and it allows customers
855857
to inject http codes not included in `Response.Status`.
856-
858+
857859
- [Removed "provided" modifier for SLF4J and Logback dependencies in the Wikipedia example](https://github.com/yahoo/fili/pull/102)
858860

859861
- [Updated dependencies](https://github.com/yahoo/fili/pull/103)
@@ -974,7 +976,7 @@ Changes:
974976
* `AggregationAverageMaker` deprecated conversion method required by deprecated sketch library
975977

976978
- [Metric configuration deprecations](https://github.com/yahoo/fili/pull/124)
977-
* Deprecated superfluous constructor of `FilteredAggregator` with superfluous argument
979+
* Deprecated superfluous constructor of `FilteredAggregator` with superfluous argument
978980
* Deprecated MetricMaker utility method in favor of using new field accessor on Metric
979981

980982
- [Deprecated MetricMaker.getDependentQuery lookup method in favor of simpler direct access](https://github.com/yahoo/fili/pull/124)
@@ -997,7 +999,7 @@ Changes:
997999
* Discovered a bug where `user_roles` is declared but unset still reads as a list with empty string (included a temporary fix by commenting the variable declaration)
9981000
* Refactored `RoleBasedAuthFilter` and `RoleBasedAuthFilterSpec` for better testing
9991001

1000-
- [Added missing coverage for `ThetaSketchEstimate` unwrapping in `MetricMaker.getSketchField`](https://github.com/yahoo/fili/pull/128)
1002+
- [Added missing coverage for `ThetaSketchEstimate` unwrapping in `MetricMaker.getSketchField`](https://github.com/yahoo/fili/pull/128)
10011003

10021004
- [`DataSource::getNames` now returns Fili identifiers, not fact store identifiers](https://github.com/yahoo/fili/pull/125/files)
10031005

@@ -1009,7 +1011,7 @@ Changes:
10091011

10101012
### Removed:
10111013

1012-
- [Removed invalid constructor from SketchRoundUpMappepr](https://github.com/yahoo/fili/pull/148)
1014+
- [Removed invalid constructor from SketchRoundUpMappepr](https://github.com/yahoo/fili/pull/148)
10131015

10141016

10151017
v0.6.29 - 2016/11/16
@@ -1040,7 +1042,7 @@ New Capabilities & Enhancements:
10401042

10411043
- [Added Dimension Value implementation for PartitionTableDefinition]
10421044
* Added `DimensionIdFilter` implementation of `DataSourceFilter`
1043-
* Created `DimensionListPartitionTableDefinition`
1045+
* Created `DimensionListPartitionTableDefinition`
10441046

10451047
- [Added 'hasAnyRows' to SearchProvider interface](https://github.com/yahoo/fili/pull/259)
10461048
* Has Any Rows allows implementations to optimize queries which only need to identify existence of matches
@@ -1062,8 +1064,8 @@ New Capabilities & Enhancements:
10621064
* Slice availability can be used to debug availability issues on Physical tables
10631065

10641066
- [Ability to set headers for requests to Druid](https://github.com/yahoo/fili/pull/62)
1065-
* The `AsyncDruidWebServiceImpl` now accepts a `Supplier<Map<String, String>>` argument which specifies the headers
1066-
to add to the Druid data requests. This feature is made configurable through `SystemConfig` in the
1067+
* The `AsyncDruidWebServiceImpl` now accepts a `Supplier<Map<String, String>>` argument which specifies the headers
1068+
to add to the Druid data requests. This feature is made configurable through `SystemConfig` in the
10671069
`AbstractBinderFactory`.
10681070

10691071
### Changed:
@@ -1083,12 +1085,12 @@ New Capabilities & Enhancements:
10831085
* This change is made to allow running multi-api request with csv format using chrome browser.
10841086

10851087
- [Improves error messages when querying Druid goes wrong](https://github.com/yahoo/fili/pull/61)
1086-
* The `ResponseException` now includes a message that prints the `ResponseException`'s internal state
1087-
(i.e. the druid query and response code) using the error messages
1088+
* The `ResponseException` now includes a message that prints the `ResponseException`'s internal state
1089+
(i.e. the druid query and response code) using the error messages
10881090
`ErrorMessageFormat::FAILED_TO_SEND_QUERY_TO_DRUID` and `ErrorMessageFormat::ERROR_FROM_DRUID`
1089-
* The druid query and status code, reason and response body are now logged at the error level in the
1090-
failure and error callbacks in `AsyncDruidWebServiceImpl`
1091-
1091+
* The druid query and status code, reason and response body are now logged at the error level in the
1092+
failure and error callbacks in `AsyncDruidWebServiceImpl`
1093+
10921094
- [Fili now supports custom Druid query types](https://github.com/yahoo/fili/pull/57)
10931095
* `QueryType` has been turned into an interface, backed by an enum `DefaultQueryType`.
10941096
- The default implementations of `DruidResponseParser` `DruidQueryBuilder`, `WeightEvaluationQuery` and
@@ -1115,9 +1117,9 @@ New Capabilities & Enhancements:
11151117

11161118
- Cleaned up dependencies in pom files
11171119
* Moved version management of dependencies up to the parent Pom's dependency management section
1118-
* Cleaned up the parent Pom's dependency section to only be those dependencies that truly _every_ sub-project should
1120+
* Cleaned up the parent Pom's dependency section to only be those dependencies that truly _every_ sub-project should
11191121
depend on.
1120-
* Cleaned up sub-project Pom dependency sections to handle and better use the dependencies the parent Pom provides
1122+
* Cleaned up sub-project Pom dependency sections to handle and better use the dependencies the parent Pom provides
11211123

11221124
### Deprecated:
11231125

@@ -1148,22 +1150,22 @@ New Capabilities & Enhancements:
11481150

11491151
- [Adds read locking to all attempts to read the Lucene index](https://github.com/yahoo/fili/pull/52)
11501152
* Before, if Fili attempted to read from the Lucene indices (i.e. processing a query with filters) while loading
1151-
dimension indices, the request would fail and we would get a `LuceneIndexReaderAlreadyClosedException`. Now, the
1153+
dimension indices, the request would fail and we would get a `LuceneIndexReaderAlreadyClosedException`. Now, the
11521154
read locks should ensure that the query processing will wait until indexing completes (and vice versa).
11531155

11541156
- [Fixes a bug where job metadata was being stored in the `ApiJobStore` even when the results came back synchronously](https://github.com/yahoo/fili/pull/49)
1155-
* The workflow that updates the job's metadata with `success` was running even when the query was synchronous. That
1157+
* The workflow that updates the job's metadata with `success` was running even when the query was synchronous. That
11561158
update also caused the ticket to be stored in the `ApiJobStore`.
11571159
* The delay operator didn't stop the "update" workflow from executing because it viewed an `Observable::onCompleted`
1158-
call as a message for the purpose of the delay. Since the two observables that that the metadata update gated on
1160+
call as a message for the purpose of the delay. Since the two observables that that the metadata update gated on
11591161
are empty when the query is synchronous, the "update metadata" workflow was being triggered every time.
11601162
* The delay operator was replaced by `zipWith` as a gating mechanism.
1161-
1163+
11621164
- [#45, removing sorting from weight check queries](https://github.com/yahoo/fili/pull/46)
11631165

11641166
- [`JsonSlurper` can now handle sorting lists with mixed-type entries](https://github.com/yahoo/fili/pull/58)
11651167
* even if the list starts with a string, number, or boolean
1166-
1168+
11671169
- [Broken segment metadata with Druid v0.9.1](https://github.com/yahoo/fili/issues/63)
11681170
* Made `NumberedShardSpec` ignore unexpected properties during deserialization
11691171
* Added tests to `DataSourceMetadataLoaderSpec` to test the v.0.9.1 optional field `shardSpec.partitionDimensions`
@@ -1182,7 +1184,7 @@ Jobs resource. Here are the highlights of what's in this release:
11821184
- Filtering and pagination on the Jobs resource
11831185
- A `userId` field for default Job resource representations
11841186
- Package cleanup for the jobs-related classes
1185-
1187+
11861188
### Added:
11871189

11881190
- [`always` keyword for the `asyncAfter` parameter now guarantees that a query will be asynchronous](https://github.com/yahoo/fili/pull/39)
@@ -1202,7 +1204,7 @@ Jobs resource. Here are the highlights of what's in this release:
12021204
* Added `JobRowFilter` to hold filter information
12031205

12041206
- [QueryTimeLookup Functionality Testing](https://github.com/yahoo/fili/pull/34)
1205-
* Added two tests `LookupDimensionFilteringDataServletSpec` and `LookupDimensionGroupingDataServletSpec` to test QTL
1207+
* Added two tests `LookupDimensionFilteringDataServletSpec` and `LookupDimensionGroupingDataServletSpec` to test QTL
12061208
functionality
12071209

12081210
- [Lookup Dimension Serializer](https://github.com/yahoo/fili/pull/31)
@@ -1236,7 +1238,7 @@ Jobs resource. Here are the highlights of what's in this release:
12361238
for thread-safe tests.
12371239

12381240
- [Removed `JobsApiRequest::handleBroadcastChannelNotification`](https://github.com/yahoo/fili/pull/39)
1239-
* That logic does not really belong in the `JobsApiRequest` (which is responsible for modeling a response, not
1241+
* That logic does not really belong in the `JobsApiRequest` (which is responsible for modeling a response, not
12401242
processing it), and has been consolidated into the `JobsServlet`.
12411243

12421244
- [ISSUE-17](https://github.com/yahoo/fili/issues/17) [Added pagination parameters to `PreResponse`](https://github.com/yahoo/fili/pull/19)
@@ -1246,7 +1248,7 @@ Jobs resource. Here are the highlights of what's in this release:
12461248
* The default job payload generated by `DefaultJobPayloadBuilder` now has a `userId`
12471249

12481250
- [Removed timing component in JobsApiRequestSpec](https://github.com/yahoo/fili/pull/27)
1249-
* Rather than setting an async timeout, and then sleeping, `JobsApiRequestSpec::handleBroadcastChannelNotification`
1251+
* Rather than setting an async timeout, and then sleeping, `JobsApiRequestSpec::handleBroadcastChannelNotification`
12501252
returns an empty Observable if a timeout occurs before the notification is received now verifies that the Observable
12511253
returned terminates without sending any messages.
12521254

@@ -1267,11 +1269,11 @@ Jobs resource. Here are the highlights of what's in this release:
12671269
* `AbstractBinderFactory` now uses `TypeAwareDimensionLoader` instead of `KeyValueStoreDimensionLoader`
12681270

12691271
- [Fix Dimension Serialization Problem with Nested Queries](https://github.com/yahoo/fili/pull/15)
1270-
* Modified `DimensionToDefaultDimensionSpec` serializer to serialize Dimension to apiName if it's not in the
1272+
* Modified `DimensionToDefaultDimensionSpec` serializer to serialize Dimension to apiName if it's not in the
12711273
inner-most query
12721274
* Added `Util::hasInnerQuery` helper in serializer package to determine if query is the inner most query or not
12731275
* Added tests for `DimensionToDefaultDimensionSpec`
1274-
1276+
12751277
#### General:
12761278

12771279
- [Preserve collection order of dimensions, dimension fields and metrics](https://github.com/yahoo/fili/pull/25)

fili-core/src/main/java/com/yahoo/bard/webservice/data/dimension/Dimension.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public interface Dimension {
7575
* @param name field name
7676
*
7777
* @return DimensionField
78+
*
79+
* @throws IllegalArgumentException if this dimension does not have a field with the specified name
7880
*/
7981
DimensionField getFieldByName(String name);
8082

0 commit comments

Comments
 (0)