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

Capture err #13

Merged
merged 4 commits into from
Jan 25, 2021
Merged

Capture err #13

merged 4 commits into from
Jan 25, 2021

Conversation

vigith
Copy link
Collaborator

@vigith vigith commented Jan 24, 2021

fixes #11

There are 3 queries that are failing which I have commented out. We might have to tackle using a different PR.

@vigith vigith requested a review from jbguerraz January 24, 2021 17:07
@vigith
Copy link
Collaborator Author

vigith commented Jan 24, 2021

Error 1/3

{"context":{"a":"a"},"dataSource":{"name":"wikipedia","type":"table"},"queryType":"dataSourceMetadata"} is failing because intervals is optional for dataSourceMetadata.

The intervals.Load in builder/query/query.go#69 we do a Load with empty []byte which causes JSON Umarshall to fail with the following error Load failed, unexpected end of JSON input . Tackle it using a different PR?

@vigith
Copy link
Collaborator Author

vigith commented Jan 24, 2021

Error 2/3

{
"batchSize":20480,
"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"],
"dataSource":{"type":"query","query":{"queryType":"scan","dataSource":{"type":"table","name":"A"},"columns":["AT"],"intervals":{"type":"intervals","intervals":["1980-06-12T22:30:00.000Z/2020-01-26T23:00:00.000Z"]}}},
"filter":{"dimension":"countryName","extractionFn":{"locale":"","type":"lower"},"type":"selector","value":"france"},
"intervals":{"type":"intervals","intervals":["1980-06-12T22:30:00.000Z/2020-01-26T23:00:00.000Z"]},
"limit":10,
"order":"descending",
"queryType":"scan"
}

The above querying is failing when executed directly on Apache Druid with below error. I think this is a query error and not a bug in code. Perhaps we just need to fix this query.

Time-ordering on scan queries is only supported for queries with segment specs of type MultipleSpecificSegmentSpec or SpecificSegmentSpec...a [MultipleIntervalSegmentSpec] was received instead.

@vigith
Copy link
Collaborator Author

vigith commented Jan 24, 2021

Error 3/3

{
"context":{"con":"text"},
"query":"SELECT \"__time\", \"channel\", \"cityName\", \"comment\", \"count\", \"countryIsoCode\", \"countryName\", \"diffUrl\", \"flags\", \"isAnonymous\", \"isMinor\", \"isNew\", \"isRobot\", \"isUnpatrolled\", \"metroCode\", \"namespace\", \"page\", \"regionIsoCode\", \"regionName\", \"sum_added\", \"sum_commentLength\", \"sum_deleted\", \"sum_delta\", \"sum_deltaBucket\", \"user\"\nFROM \"wikipedia\"\nWHERE \"countryName\" = 'France'\nLIMIT 10",
"queryType":"sql", 
"resultFormat":"array", 
"header": true
}

The above is failing with the below error when executed on Druid Query composer, possibly a query error.

Could not resolve type id 'sql' as a subtype of `org.apache.druid.query.Query`: known type ids = [dataSourceMetadata, groupBy, scan, search, segmentMetadata, select, timeBoundary, timeseries, topN] at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 512]

spew.Dump(q)
_, err = d.Query().Execute(q, &results)
if err != nil {
log.Fatalf("Load failed, %s (query: %s)", err, string(qry))
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe great to distinguish that case with a message like "Execute failed", %s (query : %s)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

which case are you talking about? I didn't get the context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nm.. i got it now, i will fix the comment 😄

@jbguerraz
Copy link
Contributor

Error 3/3

{
"context":{"con":"text"},
"query":"SELECT \"__time\", \"channel\", \"cityName\", \"comment\", \"count\", \"countryIsoCode\", \"countryName\", \"diffUrl\", \"flags\", \"isAnonymous\", \"isMinor\", \"isNew\", \"isRobot\", \"isUnpatrolled\", \"metroCode\", \"namespace\", \"page\", \"regionIsoCode\", \"regionName\", \"sum_added\", \"sum_commentLength\", \"sum_deleted\", \"sum_delta\", \"sum_deltaBucket\", \"user\"\nFROM \"wikipedia\"\nWHERE \"countryName\" = 'France'\nLIMIT 10",
"queryType":"sql", 
"resultFormat":"array", 
"header": true
}

The above is failing with the below error when executed on Druid Query composer, possibly a query error.

Could not resolve type id 'sql' as a subtype of `org.apache.druid.query.Query`: known type ids = [dataSourceMetadata, groupBy, scan, search, segmentMetadata, select, timeBoundary, timeseries, topN] at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 512]

This works well. The SQL type is not a JSON query for Druid, it's managed that way by this library but at the end it submits the query to the dedicated SQL service https://druid.apache.org/docs/latest/querying/sql.html#http-post
https://github.com/grafadruid/go-druid/blob/captureErr/query.go#L20

(*query.SQL)(0xc000098510)({
 Base: (query.Base) {
  ID: (string) "",
  QueryType: (string) (len=3) "sql",
  DataSource: (builder.DataSource) <nil>,
  Intervals: (builder.Intervals) <nil>,
  Context: (map[string]interface {}) (len=1) {
   (string) (len=3) "con": (string) (len=4) "text"
  }
 },
 Query: (string) (len=385) "SELECT \"__time\", \"channel\", \"cityName\", \"comment\", \"count\", \"countryIsoCode\", \"countryName\", \
"diffUrl\", \"flags\", \"isAnonymous\", \"isMinor\", \"isNew\", \"isRobot\", \"isUnpatrolled\", \"metroCode\", \"namespace\", \"page\", 
\"regionIsoCode\", \"regionName\", \"sum_added\", \"sum_commentLength\", \"sum_deleted\", \"sum_delta\", \"sum_deltaBucket\", \"user\"\n
FROM \"wikipedia\"\nWHERE \"countryName\" = 'France'\nLIMIT 10",
 ResultFormat: (string) (len=5) "array",
 Header: (bool) true,
 Parameters: ([]query.SQLParameter) <nil>
})
([]interface {}) (len=11 cap=16) {
 ([]interface {}) (len=25 cap=32) {
  (string) (len=6) "__time",
  (string) (len=7) "channel",
  (string) (len=8) "cityName",
  (string) (len=7) "comment",
  (string) (len=5) "count",
  (string) (len=14) "countryIsoCode",
  (string) (len=11) "countryName",
  (string) (len=7) "diffUrl",
  (string) (len=5) "flags",
  (string) (len=11) "isAnonymous",
  (string) (len=7) "isMinor",
  (string) (len=5) "isNew",
  (string) (len=7) "isRobot",
  (string) (len=13) "isUnpatrolled",
  (string) (len=9) "metroCode",
  (string) (len=9) "namespace",
  (string) (len=4) "page",
  (string) (len=13) "regionIsoCode",
  (string) (len=10) "regionName",
  (string) (len=9) "sum_added",
  (string) (len=17) "sum_commentLength",
  (string) (len=11) "sum_deleted",
  (string) (len=9) "sum_delta",
  (string) (len=15) "sum_deltaBucket",
  (string) (len=4) "user"
 },
 ([]interface {}) (len=25 cap=32) {
  (string) (len=24) "2016-06-27T00:00:00.000Z",
  (string) (len=13) "#fr.wikipedia",
  (string) "",
...

@jbguerraz
Copy link
Contributor

Error 2/3

{
"batchSize":20480,
"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"],
"dataSource":{"type":"query","query":{"queryType":"scan","dataSource":{"type":"table","name":"A"},"columns":["AT"],"intervals":{"type":"intervals","intervals":["1980-06-12T22:30:00.000Z/2020-01-26T23:00:00.000Z"]}}},
"filter":{"dimension":"countryName","extractionFn":{"locale":"","type":"lower"},"type":"selector","value":"france"},
"intervals":{"type":"intervals","intervals":["1980-06-12T22:30:00.000Z/2020-01-26T23:00:00.000Z"]},
"limit":10,
"order":"descending",
"queryType":"scan"
}

The above querying is failing when executed directly on Apache Druid with below error. I think this is a query error and not a bug in code. Perhaps we just need to fix this query.

Time-ordering on scan queries is only supported for queries with segment specs of type MultipleSpecificSegmentSpec or SpecificSegmentSpec...a [MultipleIntervalSegmentSpec] was received instead.

This query must have never worked indeed. Introduced here: 4995687#diff-7c1b8c5172fe7687c2af90f55f18e7e5eacf13af953ccc2bbeb5de3fa56e2688R25

Probably used only to debug the object model of the query (specific to circular dependency) rather than for getting results. We should fix it so it is valid and return results but still test the sub-query case

@vigith vigith requested a review from jbguerraz January 25, 2021 14:23
@jbguerraz jbguerraz merged commit 4205eaa into master Jan 25, 2021
@jbguerraz jbguerraz deleted the captureErr branch January 25, 2021 15:31
@saketbairoliya2
Copy link
Contributor

@vigith / @jbguerraz - Did we fix the issue with #15 ? I'm not clear on the approach I should take to make this work, Can you help here?

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.

return error for base unmarshall json
3 participants