From af83205032913dba67e3884b10bd6111e184783f Mon Sep 17 00:00:00 2001 From: nagamocha3000 Date: Wed, 2 Jun 2021 21:28:07 +0300 Subject: [PATCH 1/4] Fix percentile overflow error --- executor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/executor.go b/executor.go index ae63759f8..142033a29 100644 --- a/executor.go +++ b/executor.go @@ -1295,7 +1295,9 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string min, max := minVal.Val, maxVal.Val // estimate nth val, eg median when nth=0.5 for min < max { - possibleNthVal := (max + min) / 2 + // compute average without integer overflow, then correct for division of + // odd numbers by 2 + possibleNthVal := ((max / 2) + (min / 2)) + (((max % 2) + (min % 2)) / 2) // get left count rangeCall.Args[fieldName] = &pql.Condition{ Op: pql.Token(pql.LT), From b1d18a1ba320c5b659814f2e08e6d0dc57ff4831 Mon Sep 17 00:00:00 2001 From: nagamocha3000 Date: Thu, 3 Jun 2021 21:55:11 +0300 Subject: [PATCH 2/4] Make percentile checker in test-case match executor implementation --- executor.go | 1 + executor_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/executor.go b/executor.go index 142033a29..15d6fb571 100644 --- a/executor.go +++ b/executor.go @@ -1298,6 +1298,7 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string // compute average without integer overflow, then correct for division of // odd numbers by 2 possibleNthVal := ((max / 2) + (min / 2)) + (((max % 2) + (min % 2)) / 2) + // possibleNthVal = (max + min) / 2 // get left count rangeCall.Args[fieldName] = &pql.Condition{ Op: pql.Token(pql.LT), diff --git a/executor_test.go b/executor_test.go index 2b37c36b2..9427914b2 100644 --- a/executor_test.go +++ b/executor_test.go @@ -6939,7 +6939,7 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) { possibleNthVal := int64(0) // bin search for min < max { - possibleNthVal = (max + min) / 2 + possibleNthVal = ((max / 2) + (min / 2)) + (((max % 2) + (min % 2)) / 2) leftCount, rightCount := int64(0), int64(0) for _, num := range nums { if num < possibleNthVal { From c1915ff361fa1614c20992fa31957b366816ed54 Mon Sep 17 00:00:00 2001 From: Stephanie Yang Date: Tue, 25 May 2021 14:08:39 -0500 Subject: [PATCH 3/4] filter out saved queries without rowCalls --- lattice/src/App/QueryBuilder/QueryBuilder.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lattice/src/App/QueryBuilder/QueryBuilder.tsx b/lattice/src/App/QueryBuilder/QueryBuilder.tsx index b8a048556..fcad11f97 100644 --- a/lattice/src/App/QueryBuilder/QueryBuilder.tsx +++ b/lattice/src/App/QueryBuilder/QueryBuilder.tsx @@ -104,10 +104,13 @@ export const QueryBuilder: FC = ({ useEffect(() => { setGroupByFilters( queriesList.filter( - (q) => q.table === selectedTable.name && q.operation === 'Extract' + (q) => + q.table === selectedTable.name && + q.operation === 'Extract' && + q.rowCalls.length > 0 ) ); - }, [selectedTable]); + }, [selectedTable, queriesList]); const getColumnsToShow = (cols?: { name: string; show: boolean }[]) => { let columns: string[] = []; From 3801d4b0725021a536ff08c0fc7b18998f5d7b23 Mon Sep 17 00:00:00 2001 From: Stephanie Yang Date: Wed, 2 Jun 2021 14:58:35 -0500 Subject: [PATCH 4/4] add gitignore to lattice folder --- lattice/.gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lattice/.gitignore diff --git a/lattice/.gitignore b/lattice/.gitignore new file mode 100644 index 000000000..a17dd714d --- /dev/null +++ b/lattice/.gitignore @@ -0,0 +1,16 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +npm-debug.log* +yarn-debug.log* +yarn-error.log*