Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler float index conv., xsd:double fix #196 #199

Merged
merged 3 commits into from Mar 15, 2019
Merged

Simpler float index conv., xsd:double fix #196 #199

merged 3 commits into from Mar 15, 2019

Conversation

niklas88
Copy link
Member

@niklas88 niklas88 commented Mar 6, 2019

This is WIP, we may want to also restore if the original value was
xsd:double or xsd:decimal

@niklas88 niklas88 requested a review from joka921 March 6, 2019 16:50
In another change we may want to also restore if the original value was
xsd:double or xsd:decimal
This is similar to our previous treatment of xsd:integer vs xsd:float
and allows us to filter on decimals and doubles while retrieving them
with the correct type information instead of just treating them as
aliases for xsd:float

NOTE: This requires an index rebuild!
@niklas88 niklas88 requested review from floriankramer and removed request for joka921 March 15, 2019 10:42
@niklas88
Copy link
Member Author

Ok I've just tested this on Wikidata Full and with the queries from #196 and it works really well (after previously running the wrong version on the new index). @floriankramer or @joka921 can you give this a quick look?

Copy link
Member

@floriankramer floriankramer left a comment

Choose a reason for hiding this comment

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

Some minor nitpicking, but looks good overall.

@@ -226,8 +226,7 @@ void processGroup(const GroupBy::Aggregate& a, size_t blockStart,
} else {
// Remove the trailing character indicating if the value
// is an integer or a float.
res += ad_utility::convertIndexWordToFloat(
entity.substr(0, entity.size() - 1));
res += ad_utility::convertIndexWordToFloat(entity);
Copy link
Member

Choose a reason for hiding this comment

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

Given that we no longer remove the trailing character, we should probably update the comment.

DECIMAL = 'T'
};

//! Converts like "12.34" to :v:float:PP0*2E0*1234F and -0.123 to
Copy link
Member

Choose a reason for hiding this comment

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

Converts like -> Converts strings like

inline string convertFloatStringToIndexWord(
const string& value, const NumericType type = NumericType::FLOAT);

//! Converts like this: :v:float:PP0*2E0*1234F to "12.34" and
Copy link
Member

Choose a reason for hiding this comment

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

Converts like -> Converts strings like

//! by convertNumericToIndexWord() and convertValueLiteralToIndexWord()
//! as these add :v:<type>: in front
//! TODO(schnelle): Rename this to reflect the above
//! Converts like this: ":v:float:PP0*2E0*1234F to "12.34 and
Copy link
Member

Choose a reason for hiding this comment

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

Converts like -> Converts strings like

@@ -159,16 +170,25 @@ string convertIndexWordToValueLiteral(const string& indexWord) {
if (startsWith(indexWord, VALUE_FLOAT_PREFIX)) {
if (endsWith(indexWord, "F")) {
Copy link
Member

Choose a reason for hiding this comment

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

If we use indexWord.back() (which is save as long as VALUE_FLOAT_PREFIX is non empty) we could use the new NumericType enumeration for the comparison here.

@@ -246,8 +265,9 @@ string convertFloatToIndexWord(const string& orig, size_t nofExponentDigits,
}

// Add padding to the exponent;
AD_CHECK_GT(nofExponentDigits, expoString.size());
size_t nofPaddingElems = nofExponentDigits - expoString.size();
AD_CHECK_GT(DEFAULT_NOF_VALUE_EXPONENT_DIGITS, expoString.size());
Copy link
Member

Choose a reason for hiding this comment

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

Given that we no longer override its value we could remove the DEFAULT from DEFAULT_NOF_VALUE_EXPONENT_DIGITS

Also addresses a few other nitpicks from the review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants