Skip to content

Commit

Permalink
feat: run extra query on QueryObject and add compare operator for pos…
Browse files Browse the repository at this point in the history
…t_processing (#15279)

* rebase master and resolve conflicts

* pylint to makefile

* fix crash when pivot operator

* fix comments

* add precision argument

* query test

* wip

* fix ut

* rename

* set time_offsets to cache key

wip

* refactor get_df_payload

wip

* extra query cache

* cache ut

* normalize df

* fix timeoffset

* fix ut

* make cache key logging sense

* resolve conflicts

* backend follow up iteration 1

wip

* rolling window type

* rebase master

* py lint and minor follow ups

* pylintrc
  • Loading branch information
zhaoyongjie authored Jul 28, 2021
1 parent bdfc2dc commit 32d2aa0
Show file tree
Hide file tree
Showing 17 changed files with 744 additions and 149 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ format: py-format js-format
py-format: pre-commit
pre-commit run black --all-files

py-lint: pre-commit
pylint -j 0 superset

js-format:
cd superset-frontend; npm run prettier
23 changes: 20 additions & 3 deletions superset/charts/commands/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
)


class TimeRangeUnclearError(ValidationError):
class TimeRangeAmbiguousError(ValidationError):
"""
Time range is in valid error.
Time range is ambiguous error.
"""

def __init__(self, human_readable: str) -> None:
super().__init__(
_(
"Time string is unclear."
"Time string is ambiguous."
" Please specify [%(human_readable)s ago]"
" or [%(human_readable)s later].",
human_readable=human_readable,
Expand All @@ -56,6 +56,23 @@ def __init__(self, human_readable: str) -> None:
)


class TimeDeltaAmbiguousError(ValidationError):
"""
Time delta is ambiguous error.
"""

def __init__(self, human_readable: str) -> None:
super().__init__(
_(
"Time delta is ambiguous."
" Please specify [%(human_readable)s ago]"
" or [%(human_readable)s later].",
human_readable=human_readable,
),
field_name="time_range",
)


class DatabaseNotFoundValidationError(ValidationError):
"""
Marshmallow validation error for database does not exist
Expand Down
3 changes: 3 additions & 0 deletions superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,8 @@ class ChartDataPostProcessingOperationSchema(Schema):
"rolling",
"select",
"sort",
"diff",
"compare",
)
),
example="aggregate",
Expand Down Expand Up @@ -1074,6 +1076,7 @@ class Meta: # pylint: disable=too-few-public-methods
description="Should the rowcount of the actual query be returned",
allow_none=True,
)
time_offsets = fields.List(fields.String(), allow_none=True,)


class ChartDataQueryContextSchema(Schema):
Expand Down
Loading

0 comments on commit 32d2aa0

Please sign in to comment.