Skip to content

Commit

Permalink
[FE-17337] Move sample to end of query for metis codegen (#659)
Browse files Browse the repository at this point in the history
* Move sample to end of query for metis codegen

* Remove debugs

* Fix unit test for pointmap

---------

Co-authored-by: Chris Matzenbach <chris.matzenbach@omnisci.com>
  • Loading branch information
cmatzenbach and Chris Matzenbach committed Nov 20, 2023
1 parent 6674ce8 commit 069ad75
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
28 changes: 14 additions & 14 deletions src/mixins/raster-layer-line-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ export default function rasterLayerLineMixin(_layer) {
})
}

if (typeof filter === "string" && filter.length) {
transforms.push({
type: "filter",
expr: filter
})
}

if (typeof globalFilter === "string" && globalFilter.length) {
transforms.push({
type: "filter",
expr: globalFilter
})
}

if (typeof transform.limit === "number") {
if (transform.sample && !doJoin()) {
// use Knuth's hash sampling on single data source chart
Expand All @@ -256,20 +270,6 @@ export default function rasterLayerLineMixin(_layer) {
}
}

if (typeof filter === "string" && filter.length) {
transforms.push({
type: "filter",
expr: filter
})
}

if (typeof globalFilter === "string" && globalFilter.length) {
transforms.push({
type: "filter",
expr: globalFilter
})
}

return transforms
}

Expand Down
32 changes: 16 additions & 16 deletions src/mixins/raster-layer-point-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,6 @@ export default function rasterLayerPointMixin(_layer) {
})
}

if (typeof transform.limit === "number") {
transforms.push({
type: "limit",
row: transform.limit
})
if (transform.sample) {
transforms.push({
type: "sample",
method: "multiplicative",
size: lastFilteredSize || transform.tableSize,
limit: transform.limit,
sampleTable: table
})
}
}

if (typeof size === "object" && size.type === "quantitative") {
transforms.push({
type: "project",
Expand Down Expand Up @@ -342,6 +326,22 @@ export default function rasterLayerPointMixin(_layer) {
})
}

if (typeof transform.limit === "number") {
transforms.push({
type: "limit",
row: transform.limit
})
if (transform.sample) {
transforms.push({
type: "sample",
method: "multiplicative",
size: lastFilteredSize || transform.tableSize,
limit: transform.limit,
sampleTable: table
})
}
}

return transforms
}

Expand Down
4 changes: 2 additions & 2 deletions src/mixins/raster-layer-point-mixin.unit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ describe("rasterLayerPointMixin", () => {
"SELECT conv_4326_900913_x(lon) AS x, "
+ "conv_4326_900913_y(lat) AS y "
+ "FROM tweets_nov_feb "
+ "WHERE SAMPLE_RATIO(0.0016816902723414068) "
+ "AND (lon = 100) LIMIT 2000000"
+ "WHERE (lon = 100) "
+ "AND SAMPLE_RATIO(0.0016816902723414068) LIMIT 2000000"
)

})
Expand Down
32 changes: 16 additions & 16 deletions src/mixins/raster-layer-windbarb-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,6 @@ export default function rasterLayerWindBarbMixin(_layer) {
})
}

if (typeof transform.limit === "number") {
transforms.push({
type: "limit",
row: transform.limit
})
if (transform.sample) {
transforms.push({
type: "sample",
method: "multiplicative",
size: lastFilteredSize || transform.tableSize,
limit: transform.limit,
sampleTable: table
})
}
}

if (typeof size === "object" && size.type === "quantitative") {
transforms.push({
type: "project",
Expand Down Expand Up @@ -203,6 +187,22 @@ export default function rasterLayerWindBarbMixin(_layer) {
})
}

if (typeof transform.limit === "number") {
transforms.push({
type: "limit",
row: transform.limit
})
if (transform.sample) {
transforms.push({
type: "sample",
method: "multiplicative",
size: lastFilteredSize || transform.tableSize,
limit: transform.limit,
sampleTable: table
})
}
}

return transforms
}

Expand Down

0 comments on commit 069ad75

Please sign in to comment.