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

InfluxDB 2.0: The Expressions doesn't have defined a location [area/api] #13367

Closed
bednar opened this issue Apr 9, 2019 · 2 comments
Closed

Comments

@bednar
Copy link
Contributor

bednar commented Apr 9, 2019

The expressions are defined as:

ArrayExpression:
      description: used to create and directly specify the elements of an array object
      type: object
      properties:
        type:
          $ref: "#/components/schemas/NodeType"
        elements:
          description: elements of the array
          type: array
          items:
            $ref: "#/components/schemas/Expression"
    FunctionExpression:
      description: function expression
      type: object
      properties:
        type:
          $ref: "#/components/schemas/NodeType"
        params:
          description: function parameters
          type: array
          items:
            $ref: "#/components/schemas/Property"
        body:
          $ref: "#/components/schemas/Node"
    BinaryExpression:
      description:  uses binary operators to act on two operands in an expression
      type: object
      properties:
        type:
          $ref: "#/components/schemas/NodeType"
        operator:
          type: string
        left:
          $ref: "#/components/schemas/Expression"
        right:
          $ref: "#/components/schemas/Expression"

...

but in the HTTP response of an analysed query is also a location property:

-> POST 
-> http://127.0.0.1:9999/api/v2/query/ast
-> {
	"query": "from(bucket: \"telegraf\")\n |> filter(fn: (r) => (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\")) |> range(start: -1d)"
}

<- 200 
<- OK
<- {
	"ast": {
		"type": "Package",
		"package": "main",
		"files": [{
			"type": "File",
			"location": {
				"start": {
					"line": 1,
					"column": 1
				},
				"end": {
					"line": 2,
					"column": 107
				},
				"source": "from(bucket: \"telegraf\")\n |\u003e filter(fn: (r) =\u003e (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\")) |\u003e range(start: -1d)"
			},
			"package": null,
			"imports": null,
			"body": [{
				"type": "ExpressionStatement",
				"location": {
					"start": {
						"line": 1,
						"column": 1
					},
					"end": {
						"line": 2,
						"column": 107
					},
					"source": "from(bucket: \"telegraf\")\n |\u003e filter(fn: (r) =\u003e (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\")) |\u003e range(start: -1d)"
				},
				"expression": {
					"type": "PipeExpression",
					"location": {
						"start": {
							"line": 1,
							"column": 1
						},
						"end": {
							"line": 2,
							"column": 107
						},
						"source": "from(bucket: \"telegraf\")\n |\u003e filter(fn: (r) =\u003e (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\")) |\u003e range(start: -1d)"
					},
					"argument": {
						"type": "PipeExpression",
						"location": {
							"start": {
								"line": 1,
								"column": 1
							},
							"end": {
								"line": 2,
								"column": 86
							},
							"source": "from(bucket: \"telegraf\")\n |\u003e filter(fn: (r) =\u003e (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\"))"
						},
						"argument": {
							"type": "CallExpression",
							"location": {
								"start": {
									"line": 1,
									"column": 1
								},
								"end": {
									"line": 1,
									"column": 25
								},
								"source": "from(bucket: \"telegraf\")"
							},
							"callee": {
								"type": "Identifier",
								"location": {
									"start": {
										"line": 1,
										"column": 1
									},
									"end": {
										"line": 1,
										"column": 5
									},
									"source": "from"
								},
								"name": "from"
							},
							"arguments": [{
								"type": "ObjectExpression",
								"location": {
									"start": {
										"line": 1,
										"column": 6
									},
									"end": {
										"line": 1,
										"column": 24
									},
									"source": "bucket: \"telegraf\""
								},

							...

					}
				}
			}]
		}]
	}
}
@russorat russorat transferred this issue from influxdata/influxdb Apr 12, 2019
@nathanielc nathanielc transferred this issue from influxdata/flux Apr 12, 2019
@stale
Copy link

stale bot commented Sep 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 29, 2019
@stale
Copy link

stale bot commented Oct 6, 2019

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

@stale stale bot closed this as completed Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants