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

[query] Fix absent function to work correctly #1871

Merged
merged 12 commits into from
Aug 22, 2019
Merged

Conversation

arnikola
Copy link
Collaborator

What this PR does / why we need it:
Fixes #1847

require.Equal(t, len(expectedTags), len(actualTags))
for i, tag := range expectedTags {
fmt.Println("x", string(tag.Name), ":", string(tag.Value))
fmt.Println("a", string(actualTags[i].Name), ":", string(actualTags[i].Value))
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably remove these Println's now yeah?

}
}

func mustMakeSeriesMeta(tags ...string) block.SeriesMeta {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Aren't these available already as test.MustMakeSeriesMeta and test.MustMakeMeta?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately adds a circular test dependency on test and block, is there a decent way of resolving it? Tried block_test package but don't think that's importable from other packages right?

@@ -228,3 +234,21 @@ func GenerateValuesAndBounds(

return values, bounds
}

// MustMakeTags creates tags given that the number of args is even.
func MustMakeTags(tag ...string) models.Tags {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm doesn't this already appear in block_test.go somewhere in this PR already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah managed to move it to block package

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, can we use this method instead of redeclaring this method in block/empty_test.go?

Seems a private version is declared there:

func mustMakeTags(tag ...string) models.Tags {
	if len(tag)%2 != 0 {
		panic("must have even tag length")
	}

 	tagLength := len(tag) / 2
	t := models.NewTags(tagLength, models.NewTagOptions())
	for i := 0; i < tagLength; i++ {
		t = t.AddTag(models.Tag{
			Name:  []byte(tag[i*2]),
			Value: []byte(tag[i*2+1]),
		})
	}

 	return t
}

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Aug 21, 2019

Codecov Report

Merging #1871 into master will increase coverage by 3.1%.
The diff coverage is 42.4%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1871      +/-   ##
=========================================
+ Coverage    62.7%   65.9%    +3.1%     
=========================================
  Files        1054     982      -72     
  Lines      101732   83610   -18122     
=========================================
- Hits        63864   55115    -8749     
+ Misses      33755   24723    -9032     
+ Partials     4113    3772     -341
Flag Coverage Δ
#aggregator 82.4% <ø> (+2.6%) ⬆️
#cluster 67.6% <ø> (+11.3%) ⬆️
#collector 47.9% <ø> (-15.8%) ⬇️
#dbnode 80% <ø> (+15.3%) ⬆️
#m3em 73.2% <ø> (+4.8%) ⬆️
#m3ninx 68.8% <ø> (+11%) ⬆️
#m3nsch 28.4% <ø> (-22.8%) ⬇️
#metrics 17.5% <ø> (ø) ⬆️
#msg 74.9% <ø> (+0.1%) ⬆️
#query 46.4% <42.4%> (-21.3%) ⬇️
#x 75% <ø> (+5.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ea63a7...a5df95c. Read the comment docs.

// allowing them to treat this as a regular block, while at the same time
// having an option to optimize by accessing the scalar value directly instead
// This represents constant values; it greatly simplifies downstream operations
// vy allowing them to treat this as a regular block, while at the same time
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: vy -> by

}

return strings.Join(tags, ", ")
return sb.String()
// return strings.Join(tags, ", ")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to remove this perhaps?

func (t Tags) String() string {
tags := make([]string, len(t.Tags))
var sb strings.Builder
// tags := make([]string, len(t.Tags))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also this?

@@ -154,6 +154,8 @@ var aggregateParseTests = []struct {
{"bottomk(3, up)", aggregation.BottomKType},
{"quantile(3, up)", aggregation.QuantileType},
{"count_values(\"some_name\", up)", aggregation.CountValuesType},

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Remove this endline?

@arnikola arnikola merged commit 9583d1e into master Aug 22, 2019
@arnikola arnikola deleted the arnikola/absent-func branch August 22, 2019 19:31
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.

Fix absent function
2 participants