You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2024/01/26 21:10:27 UTC
(superset) branch 3.0 updated (1391932d1d -> c739ce786f)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a change to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git
from 1391932d1d fix(import): only import FORMULA annotations (#26652)
new ac65817aaf fix: Row limit hardcoded (#26807)
new c739ce786f fix(time-series table): Can't compare from the beginning of the time range (#26814)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../src/shared-controls/sharedControls.tsx | 4 ++--
.../TimeSeriesColumnControl.test.tsx | 13 +++++++++++++
.../components/controls/TimeSeriesColumnControl/index.jsx | 4 +++-
.../src/visualizations/TimeTable/TimeTable.jsx | 6 ++++--
tests/integration_tests/celery_tests.py | 2 +-
tests/integration_tests/superset_test_config.py | 2 +-
6 files changed, 24 insertions(+), 7 deletions(-)
(superset) 02/02: fix(time-series table): Can't compare from the beginning of the time range (#26814)
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit c739ce786fbf474247f39702154e80d9e25274d2
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Fri Jan 26 16:06:11 2024 -0500
fix(time-series table): Can't compare from the beginning of the time range (#26814)
(cherry picked from commit 1f6c270f15797d2929babfd84c03a59fc8a99543)
---
.../TimeSeriesColumnControl.test.tsx | 13 +++++++++++++
.../components/controls/TimeSeriesColumnControl/index.jsx | 4 +++-
.../src/visualizations/TimeTable/TimeTable.jsx | 6 ++++--
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
index 589ef9173a..631c34f3f8 100644
--- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
@@ -104,6 +104,19 @@ test('triggers onChange when time lag changes', () => {
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ timeLag }));
});
+test('time lag allows negative values', () => {
+ const timeLag = '-1';
+ const onChange = jest.fn();
+ render(<TimeSeriesColumnControl colType="time" onChange={onChange} />);
+ userEvent.click(screen.getByRole('button'));
+ const timeLagInput = screen.getByPlaceholderText('Time Lag');
+ userEvent.clear(timeLagInput);
+ userEvent.type(timeLagInput, timeLag);
+ expect(onChange).not.toHaveBeenCalled();
+ userEvent.click(screen.getByRole('button', { name: 'Save' }));
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ timeLag }));
+});
+
test('triggers onChange when color bounds changes', () => {
const min = 1;
const max = 5;
diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
index 29ac223cf3..e51a2f4960 100644
--- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
+++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
@@ -248,7 +248,9 @@ export default class TimeSeriesColumnControl extends React.Component {
{['time', 'avg'].indexOf(this.state.colType) >= 0 &&
this.formRow(
t('Time lag'),
- t('Number of periods to compare against'),
+ t(
+ 'Number of periods to compare against. You can use negative numbers to compare from the beginning of the time range.',
+ ),
'time-lag',
<Input
value={this.state.timeLag}
diff --git a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
index bf8551bf07..f0e98ebf7b 100644
--- a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
+++ b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
@@ -181,11 +181,13 @@ const TimeTable = ({
let v;
let errorMsg;
if (column.colType === 'time') {
- // Time lag ratio
+ // If time lag is negative, we compare from the beginning of the data
const timeLag = column.timeLag || 0;
const totalLag = Object.keys(reversedEntries).length;
- if (timeLag >= totalLag) {
+ if (Math.abs(timeLag) >= totalLag) {
errorMsg = `The time lag set at ${timeLag} is too large for the length of data at ${reversedEntries.length}. No data available.`;
+ } else if (timeLag < 0) {
+ v = reversedEntries[totalLag + timeLag][valueField];
} else {
v = reversedEntries[timeLag][valueField];
}
(superset) 01/02: fix: Row limit hardcoded (#26807)
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit ac65817aaf8429ea1261f56cd35f28e037d5ac58
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Fri Jan 26 08:57:21 2024 -0500
fix: Row limit hardcoded (#26807)
(cherry picked from commit 5e633d2bb0909f1cb4904c07e29a2c683f02131c)
---
.../superset-ui-chart-controls/src/shared-controls/sharedControls.tsx | 4 ++--
tests/integration_tests/celery_tests.py | 2 +-
tests/integration_tests/superset_test_config.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
index 0cf9e8b390..7f2ed79ee6 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
@@ -247,10 +247,10 @@ const row_limit: SharedControlConfig<'SelectControl'> = {
freeForm: true,
label: t('Row limit'),
clearable: false,
+ mapStateToProps: state => ({ maxValue: state?.common?.conf?.SQL_MAX_ROW }),
validators: [
legacyValidateInteger,
- (v, state) =>
- validateMaxValue(v, state?.common?.conf?.SQL_MAX_ROW || DEFAULT_MAX_ROW),
+ (v, state) => validateMaxValue(v, state?.maxValue || DEFAULT_MAX_ROW),
],
default: 10000,
choices: formatSelectOptions(ROW_LIMIT_OPTIONS),
diff --git a/tests/integration_tests/celery_tests.py b/tests/integration_tests/celery_tests.py
index 29a1f7a66a..b0ac6ac6c7 100644
--- a/tests/integration_tests/celery_tests.py
+++ b/tests/integration_tests/celery_tests.py
@@ -344,7 +344,7 @@ def test_run_async_cta_query_with_lower_limit(test_client, ctas_method):
assert QUERY == query.sql
assert query.rows == (1 if backend() == "presto" else 0)
- assert query.limit == 10000
+ assert query.limit == 50000
assert query.select_as_cta
assert query.select_as_cta_used
diff --git a/tests/integration_tests/superset_test_config.py b/tests/integration_tests/superset_test_config.py
index bcc3146083..fd0da9f65f 100644
--- a/tests/integration_tests/superset_test_config.py
+++ b/tests/integration_tests/superset_test_config.py
@@ -60,7 +60,7 @@ if "sqlite" in SQLALCHEMY_DATABASE_URI:
PRESTO_POLL_INTERVAL = 0.1
HIVE_POLL_INTERVAL = 0.1
-SQL_MAX_ROW = 10000
+SQL_MAX_ROW = 50000
SQLLAB_CTAS_NO_LIMIT = True # SQL_MAX_ROW will not take effect for the CTA queries
FEATURE_FLAGS = {
**FEATURE_FLAGS,