Skip to content

Commit

Permalink
dataSourceMetadata debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jbguerraz committed Nov 28, 2020
1 parent 33f3b00 commit ed3ecd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builder/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func Load(data []byte) (builder.Query, error) {
}
var q builder.Query
switch t.Typ {
case "datasourceMetadata":
case "dataSourceMetadata":
q = NewDataSourceMetadata()
case "groupBy":
q = NewGroupBy()
Expand Down
6 changes: 6 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func main() {

var q builder.Query
var results interface{}

q, err = d.Query().Load([]byte("{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"wikipedia\"},\"intervals\":[\"1980-06-12T22:30:00.000Z/2020-01-26T23:00:00.000Z\"],\"virtualColumns\":[{\"type\":\"expression\",\"name\":\"v0\",\"expression\":\"'France'\",\"outputType\":\"STRING\"}],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"limit\":1,\"order\":\"none\",\"filter\":{\"type\":\"selector\",\"dimension\":\"countryName\",\"value\":\"France\",\"extractionFn\":null},\"columns\":[\"__time\",\"channel\",\"cityName\",\"comment\",\"count\",\"countryIsoCode\",\"diffUrl\",\"flags\",\"isAnonymous\",\"isMinor\",\"isNew\",\"isRobot\",\"isUnpatrolled\",\"metroCode\",\"namespace\",\"page\",\"regionIsoCode\",\"regionName\",\"sum_added\",\"sum_commentLength\",\"sum_deleted\",\"sum_delta\",\"sum_deltaBucket\",\"user\",\"v0\"],\"legacy\":false,\"context\":{\"sqlOuterLimit\":100,\"sqlQueryId\":\"b12ac7bb-7cc5-4873-b19d-1cd95264e01b\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}"))
spew.Dump(q)
d.Query().Execute(q, &results)
Expand Down Expand Up @@ -76,4 +77,9 @@ func main() {
spew.Dump(q, err)
d.Query().Execute(q, &results)
spew.Dump(results)

q, err = d.Query().Load([]byte("{\"context\":{\"a\":\"a\"},\"dataSource\":{\"name\":\"wikipedia\",\"type\":\"table\"},\"queryType\":\"dataSourceMetadata\"}"))
spew.Dump(q, err)
d.Query().Execute(q, &results)
spew.Dump(results)
}

0 comments on commit ed3ecd1

Please sign in to comment.