Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filter: this.subsetExpression
};
if (cluster.type === "druid") {
externalValue.rollup = this.rollup;
externalValue.timeAttribute = this.timeAttribute.name;
externalValue.introspectionStrategy = cluster.getIntrospectionStrategy();
externalValue.allowSelectQueries = true;
let externalContext: Record = options.druidContext || {};
externalContext["timeout"] = cluster.getTimeout();
externalValue.context = externalContext;
}
if (this.introspection === "none") {
externalValue.attributes = AttributeInfo.override(this.deduceAttributes(), this.attributeOverrides);
externalValue.derivedAttributes = this.derivedAttributes;
} else {
// ToDo: else if (we know that it will GET introspect) and there are no overrides apply special attributes as overrides
externalValue.attributeOverrides = this.attributeOverrides;
}
return External.fromValue(externalValue);
}
attributes.push(AttributeInfo.fromJS({ name: reference, type: "STRING" }));
}
});
measures.forEachMeasure(measure => {
const references = Measure.getReferences(measure.expression);
for (let reference of references) {
if (NamedArray.findByName(attributes, reference)) continue;
if (Measure.hasCountDistinctReferences(measure.expression)) continue;
if (Measure.hasQuantileReferences(measure.expression)) continue;
attributes.push(AttributeInfo.fromJS({ name: reference, type: "NUMBER" }));
}
});
if (attributeOverrides.length) {
attributes = AttributeInfo.override(attributes, attributeOverrides);
}
return attributes;
}
break;
default:
throw new Error(`unsupported attribute ${name}; type ${type}, native type ${nativeType}`);
}
}
if (!this.rolledUp() && !measures.containsMeasureWithName("count")) {
measures = measures.prepend(new Measure({
name: "count",
formula: $main.count().toString()
}));
}
let value = this.valueOf();
value.attributes = attributes ? AttributeInfo.override(attributes, newAttributes) : newAttributes;
value.dimensions = dimensions;
value.measures = measures;
if (!value.defaultSortMeasure) {
value.defaultSortMeasure = measures.size() ? measures.first().name : null;
}
if (!value.timeAttribute && dimensions.size && dimensions.first().kind === "time") {
value.timeAttribute = dimensions.first().expression as RefExpression;
}
return new DataCube(value);
}