Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Set & retrieve field values. #702

Merged

Conversation

benbjohnson
Copy link
Contributor

@benbjohnson benbjohnson commented Jun 30, 2017

Overview

This pull request adds support for set/get range values at the Frame, View, and Fragment levels.

Fixes #617.

Pull request checklist

Code review checklist

This is the checklist that the reviewer will follow while reviewing your pull request. You do not need to do anything with this checklist, but be aware of what the reviewer will be looking for.

  • Ensure that any changes to external docs have been included in this pull request.
  • If the changes require that minor/major versions need to be updated, tag the PR appropriately.
  • Ensure the new code is properly commented and follows Idiomatic Go.
  • Check that tests have been written and that they cover the new functionality.
  • Run tests and ensure they pass.
  • Build and run the code, performing any applicable integration testing.

@benbjohnson benbjohnson requested a review from travisturner June 30, 2017 03:37
@travisturner travisturner self-assigned this Jun 30, 2017
Copy link
Member

@travisturner travisturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.
Just one logic change which I think is minor.

frame_test.go Outdated
t.Fatal("expected change")
}

// Set value on on same column but different field.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate "on" in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 800e384.

f.mu.Lock()
defer f.mu.Unlock()

for i := uint(0); i < bitDepth; i++ {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For base-2 range-encoding, we only have to store the 0th bit vector, which ends up being the "flip" of the actual value. So if value = 20, base-2 = 10100 and base-2 range-encoded = 01011. All that to say I think the set and clear here need to be reversed. That would change the logic in FieldValue() as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I fixed the flip in 800e384. I don't quite understand the need for the flip though. Why not store in "unflipped" format?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes the range comparisons easier. For example, if you want to find all B greater than F, starting with the most significant bit of a range-encoded bitmap (bits flipped) you can do a NOR operation:

(range-encoded case where B is definitely greater than F):
B 0 0 1 1
F 0 1 0 1
---------
  T - - -

If you store it as the actual value

(equality encoded case where B is definitely greater than F):
B 0 0 1 1
F 0 1 0 1
---------
  - - T -

it's not a straightforward bitwise operation.

This commit adds support for set/get field values at the
`Frame`, `View`, and `Fragment` levels.
@benbjohnson benbjohnson force-pushed the 617-bsi-internal-set-field-value branch from d7efccd to 800e384 Compare June 30, 2017 18:21
@benbjohnson benbjohnson merged commit 3e34959 into FeatureBaseDB:master Jun 30, 2017
@benbjohnson benbjohnson deleted the 617-bsi-internal-set-field-value branch June 30, 2017 20:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BSI Range-Encoding: internal support for setting field values
2 participants