Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case 'json':
outputStr = JSON.stringify(data, null, 2);
break;
case 'csv':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = data.toCSV();
break;
case 'tsv':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = data.toTSV();
break;
case 'flat':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = JSON.stringify(data.flatten(), null, 2);
break;
default:
outputStr = 'Unknown output type';
break;
}
console.log(outputStr);
},
(err: Error) => {
(data: Dataset) => {
var outputStr: string;
switch (output) {
case 'json':
outputStr = JSON.stringify(data, null, 2);
break;
case 'csv':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = data.toCSV();
break;
case 'tsv':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = data.toTSV();
break;
case 'flat':
data = Dataset.fromJS(data.toJS()); // Temp hack
outputStr = JSON.stringify(data.flatten(), null, 2);
break;
default:
outputStr = 'Unknown output type';
break;
}
console.log(outputStr);
},
(err: Error) => {
it("works when reversing time dimension", () => {
expect(fillDatasetWithMissingValues(Dataset.fromJS(rawDatasetWithTimeDimension.data[0][SPLIT] as Dataset), "click", "__time", orderByTimeDimensionDecreasing, timezone).toJS())
.to.deep.equal(Dataset.fromJS(reversedDatasetWithTimeDimension.data[0][SPLIT] as Dataset).toJS());
});
it("works with number ranges", () => {
expect(fillDatasetWithMissingValues(Dataset.fromJS(rawDataWithNumberRanges.data[0][SPLIT] as Dataset), "added", "deltaBucket100", orderByNumberRangeDimensionIncreasing, timezone).toJS())
.to.deep.equal(Dataset.fromJS(rawDataWithNumberRanges.data[0][SPLIT] as Dataset).toJS());
});
});
it("encloses set/string in brackets appropriately", () => {
const ds = Dataset.fromJS([
{ y: ["dear", "john"] },
{ y: ["from", "peter"] }
]);
expect(datasetToFileString(ds, "csv").indexOf("\"dear, john\""), "csv").to.not.equal(-1);
expect(datasetToFileString(ds, "tsv").indexOf("dear, john"), "tsv").to.not.equal(-1);
});
});
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { basicExecutorFactory, Dataset } from "plywood";
import { DimensionsFixtures } from "../dimension/dimensions.fixtures";
import { MeasuresFixtures } from "../measure/measures.fixtures";
import { DataCube, DataCubeJS } from "./data-cube";
var executor = basicExecutorFactory({
datasets: {
wiki: Dataset.fromJS([]),
twitter: Dataset.fromJS([])
}
});
export class DataCubeFixtures {
public static get WIKI_JS(): DataCubeJS {
return {
name: "wiki",
title: "Wiki",
description: "Wiki full description something about articles and editors",
clusterName: "druid-wiki",
source: "wiki",
introspection: "none",
attributes: [
{ name: "time", type: "TIME" },
{ name: "articleName", type: "STRING" },
return AppSettingsFixtures.wikiOnly().attachExecutors(() => {
return basicExecutorFactory({
datasets: {
main: Dataset.fromJS(SMALL_WIKI_DATA)
}
});
});
}
(resp: any) => {
if (!this.mounted) return;
this.loadingDelegate.stop();
this.setState({
dataset: Dataset.fromJS(resp.dataset)
});
},
(error: Error) => {
static executorsWiki(): Lookup {
return {
wiki: basicExecutorFactory({
datasets: {
main: Dataset.fromJS(SMALL_WIKI_DATA)
}
})
};
}
}
export const getDataset = (name: string) => Dataset.fromJS(getData(name));