Comments (1)
Hey there, @Mainer-g00t! I'm here to help you with any bugs, questions, or contributions you might have for the repository. Let me know how I can assist you!
To fix the issue where only the first metric is considered in Virtual Datasets when using Pinot as a backend database in Superset, you need to ensure that the metrics are correctly set and maintained in the state. The provided code includes tests that verify the correct handling of metrics in the state, which can serve as a reference for your implementation.
Here is an example of how metrics are correctly handled in the state:
const METRICS = [
{
expressionType: 'SIMPLE',
column: {
column_name: 'a',
type: 'DOUBLE PRECISION',
},
aggregate: 'SUM',
label: 'SUM(a)',
optionName: 'metric_1a2b3c4d5f_1a2b3c4d5f',
},
{
expressionType: 'SIMPLE',
column: {
column_name: 'b',
type: 'BIGINT',
},
aggregate: 'AVG',
label: 'AVG(b)',
optionName: 'metric_6g7h8i9j0k_6g7h8i9j0k',
},
];
const mockedState = {
...defaultState,
controls: {
...defaultState.controls,
metrics: {
...defaultState.controls.metrics,
value: METRICS,
},
column_config: {
...defaultState.controls.column_config,
value: {
'AVG(b)': {
currencyFormat: {
symbolPosition: 'prefix',
symbol: 'USD',
},
},
},
},
},
form_data: {
...defaultState.form_data,
metrics: METRICS,
column_config: {
'AVG(b)': {
currencyFormat: {
symbolPosition: 'prefix',
symbol: 'USD',
},
},
},
},
};
const swappedMetrics = [METRICS[1], METRICS[0]];
const newState = exploreReducer(
mockedState,
actions.setControlValue('metrics', swappedMetrics, []),
);
const expectedColumnConfig = {
'AVG(b)': {
currencyFormat: {
symbolPosition: 'prefix',
symbol: 'USD',
},
},
};
expect(newState.controls.metrics.value).toStrictEqual(swappedMetrics);
expect(newState.form_data.metrics).toStrictEqual(swappedMetrics);
expect(newState.controls.column_config.value).toStrictEqual(expectedColumnConfig);
expect(newState.form_data.column_config).toStrictEqual(expectedColumnConfig);
This code ensures that the metrics are correctly set and maintained in the state, which should address the issue of only the first metric being considered [1].
To continue talking to Dosu, mention @dosu.
from superset.
Related Issues (20)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.