Design and Implementation of a Configurable OLAP Framework for Rapid Development
This article presents a configurable OLAP framework that streamlines multi‑dimensional, multi‑metric analysis by separating core and interaction domains, using metadata‑driven modeling, runtime request handling, and Maven‑based integration to accelerate development and improve query performance.
Background: In many projects, building OLAP systems with multi‑dimensional, multi‑metric analysis is complex, time‑consuming, and data‑intensive, requiring significant development effort.
Architecture Design: The proposed framework separates a core OLAP domain from a front‑end interaction domain, using configurable metadata and a façade service to translate requests into SQL for column‑store databases, maximizing query performance.
Detailed Design – Runtime: The façade service distinguishes request types (table, chart, export), passes the OLAP domain model to the domain service, which generates executable SQL and returns results in a unified format.
Core Domain Model: Defines the four basic OLAP operations (roll‑up, drill‑down, slice, dice) and abstracts aggregation SQL into dimensions, measures, filters, grouping, ordering, and pagination.
Metadata Configuration: Provides configurable metric metadata and module metadata for tables, charts, and export, illustrated with JSON examples.
{
"cbj_amount"
: {
"expression"
:
"sum(cbj_amount)"
,
"name"
:
"cbj_amount"
,
"desc"
:
"损失分布-仓报价金额"
},
"sale_qtty"
: {
"expression"
:
"sum(sale_qtty)"
,
"name"
:
"sale_qtty"
,
"desc"
:
"销量"
},
"loss_amount"
: {
"expression"
:
"sum(loss_amount)"
,
"name"
:
"loss_amount"
,
"desc"
:
"损额"
}
}Table configuration example:
{
"list-overall-lossCategory"
: {
"moduleName"
:
"整体诊断结果-损失类别"
,
"tableName"
:
"logis_loss_reason_nume_denom_month_dis"
,
"measureList"
: [
"dakuru_loss_ratio"
,
"dakuru_loss_ratio_yoy_chg"
,
"dakuru_loss_ratio_mom_chg"
,
"peisongru_loss_ratio"
,
"peisongru_loss_ratio_yoy_chg"
,
"peisongru_loss_ratio_mom_chg"
,
"shouhouru_loss_ratio"
,
"shouhouru_loss_ratio_yoy_chg"
,
"shouhouru_loss_ratio_mom_chg"
,
"dakupyk_loss_ratio"
,
"dakupyk_loss_ratio_yoy_chg"
,
"dakupyk_loss_ratio_mom_chg"
,
"bjkpyk_loss_ratio"
,
"bjkpyk_loss_ratio_yoy_chg"
,
"bjkpyk_loss_ratio_mom_chg"
],
"displayType"
:
"table"
,
"page"
: {
"pageNo"
:
1
,
"pageSize"
:
1
}
}
}Chart configuration example:
{
"chart-lossType-trend-lossRatio"
: {
"moduleName"
:
"损失类别走势-损率"
,
"tableName"
:
"logis_loss_reason_nume_denom_month_dis"
,
"dimList"
: [
"mt"
],
"measureList"
: [
"dakuru_loss_ratio"
,
"peisongru_loss_ratio"
,
"shouhouru_loss_ratio"
,
"bjkpyk_loss_ratio"
,
"dakupyk_loss_ratio"
],
"displayType"
:
"chart"
,
"page"
: {
"pageNo"
:
1
,
"pageSize"
:
13
},
"chart"
: {
"categoryName"
:
"损失类别走势"
,
"categoryKey"
:
"mt"
,
"seriesList"
: [
{
"key"
:
"大库入"
,
"value"
:
"dakuru_loss_ratio"
},
{
"key"
:
"配送入"
,
"value"
:
"peisongru_loss_ratio"
},
{
"key"
:
"售后入"
,
"value"
:
"shouhouru_loss_ratio"
},
{
"key"
:
"备件库盘盈亏"
,
"value"
:
"bjkpyk_loss_ratio"
},
{
"key"
:
"大库盘盈亏"
,
"value"
:
"dakupyk_loss_ratio"
}
]
}
}
}Export configuration example:
{
"export-lossType-trend"
: {
"moduleName"
:
"损失类别-损失类别走势-导出"
,
"tableName"
:
"logis_loss_reason_nume_denom_month_dis"
,
"dimList"
: [
"mt"
,
"loss_reason1"
],
"measureList"
: [
"distribute_loss_ratio"
,
"loss_amount"
,
"loss_qtty"
],
"filterList"
: [{
"lossReason1"
: {
"expr"
:
"is not null"
,
"value"
:
""
} }],
"headList"
: [
"mt"
,
"loss_reason1"
,
"distribute_loss_ratio"
,
"loss_amount"
,
"loss_qtty"
],
"fileName"
:
"损失类别走势信息"
,
"displayType"
:
"file"
,
"page"
: {
"pageNo"
:
1
,
"pageSize"
:
1000
,
"orderList"
: [ {
"orderField"
:
"mt"
,
"orderType"
:
"DESC"
}, {
"orderField"
:
"loss_reason1"
,
"orderType"
:
"DESC"
} ] }
}
}System Integration: By adding the Maven dependency, configuration files, and implementing the required extension points, developers can quickly integrate the framework into existing back‑end services.
<dependency>
<groupId>com.jd.netsim</groupId>
<artifactId>triage-framework-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>Conclusion: The article presents a generic, configurable OLAP framework that accelerates development of analytical applications, with potential for visual configuration and self‑service analytics, while acknowledging some details are omitted for brevity.
JD Retail Technology
Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.