This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- firstSibling sub-level | |
SELECT st.id orig_id, rk.id mapped_id | |
FROM (select country_id, id, RANK() over (ORDER BY country_id) _rank from states) st | |
join (SELECT country_id, id, ROW_NUMBER() over (ORDER BY country_id asc , id asc ) rownumb FROM states) rk | |
on st._rank = rk.rownumb and rk.country_id = st.country_id; | |
-- lastSibling sub-level | |
SELECT st.id orig_id, rk.id mapped_id | |
FROM (select country_id, id, RANK() over (ORDER BY country_id) _rank from states) st |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table country; | |
drop table states; | |
drop table sales; | |
CREATE TABLE | |
IF NOT EXISTS country | |
( | |
country_id INTEGER IDENTITY(1,1) , | |
_name VARCHAR(22) NOT NULL, | |
UNIQUE ( _name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
MIN(t_117.c0) AS c0, | |
MIN(t_117.c_51) AS c1, | |
t_117.c2 AS c2, | |
t_117.c3s0 AS c3s0 | |
FROM | |
( | |
SELECT | |
MIN(t_116.c0) AS c0, | |
MIN(t_116.c_51) AS c_51, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OrderCube( | |
AggregateLogical( | |
SelectedData( | |
ColumnData(SelectColumn(Some(c0),AttributeValue(FlatAttribute(62874bbe-7ead-48ac-4496-8c7758b5aaa8: "orderquantity1")),Sum), Sum, Some(c0)), | |
ColumnData(SelectColumn(Some(c1),DimensionallyModifiedValue(AggregatedValue(AttributeValue(FlatAttribute(62874bbe-7ead-48ac-4496-8c7758b5aaa8: "orderquantity1")),Sum),List(Child(CurrentMember(FlatHierarchy(9bf44374-c106-4ab3-9c6a-d68474e9b25f+3938: "Product Dimension")),true))),NoAggregation), NoAggregation, Some(c1)), | |
ColumnData(SelectColumn(Some(c2),AttributeValue(FlatAttribute(2ff18d3a-894a-4be1-6d5c-39d97245160a: "Product Line")),AggregateGrouped(true)), AggregateGrouped(true), Some(c2)), | |
ColumnData(SelectColumn(Some(c3s0),KeyValue(FlatKey(3b0e5176-ca31-4706-a508-092e3c17daa2)),AggregateGrouped(true)), AggregateGrouped(true), Some(c3s0)) | |
), | |
AuxiliaryData(), | |
UnionCubes( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
MIN(t_101.c_44) AS c0, | |
t_101.c1 AS c1, | |
t_101.c2s0 AS c2s0 | |
FROM | |
( | |
SELECT | |
MIN(t_98.c_44) AS c_44, | |
COALESCE(t_100.c_45, t_98.c1) AS c1, | |
COALESCE(t_100.c_55, t_98.c2s0) AS c2s0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
MIN(t_129.c0) AS c0, | |
MIN(t_129.c_39) AS c1, | |
t_129.c2 AS c2, | |
t_129.c3s0 AS c3s0 | |
FROM | |
( | |
SELECT | |
MIN(t_128.c0) AS c0, | |
MIN(t_128.c_39) AS c_39, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case MdxFunctions.DistinctCount.Applied(valueSet :: HNil) => | |
val resolvedVal = ConstantValue(5, IntType) | |
ComplexAggregatedValue(resolvedVal, resolveSetExpression(valueSet), core.DistinctCountExact) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AggregateLogical( | |
SelectedData( | |
ColumnData(SelectColumn(Some(c0),DimensionallyModifiedValue(AggregatedValue(AttributeValue(FlatAttribute(ef1dd654-da9a-42bc-77ef-ea4431bdeb4e: "salesamount1")),Sum),List(Child(Child(CurrentMember(FlatHierarchy(d525ca44-1aa7-4c19-bfa7-ed6e69040b00+1298889108: "Order Date Month Hierarchy")),false),false))),NoAggregation), NoAggregation, Some(c0)) | |
), | |
AuxiliaryData(), | |
AggregateLogical( | |
SelectedData( | |
DimensionallyModifiedData(ValueData(AggregatedValue(AttributeValue(FlatAttribute(ef1dd654-da9a-42bc-77ef-ea4431bdeb4e: "salesamount1")),Sum),NoAggregation,Set(RawAttribute(FlatAttribute(ef1dd654-da9a-42bc-77ef-ea4431bdeb4e: "salesamount1"),Sum,Some(c_36))),Some(c_37)),List(Child(Child(CurrentMember(FlatHierarchy(d525ca44-1aa7-4c19-bfa7-ed6e69040b00+1298889108: "Order Date Month Hierarchy")),false),false)),Min,Some(c_37)) | |
), | |
AuxiliaryData(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeSelectColumn(gb: GroupByType): Option[SelectColumn] = { | |
gb match { | |
case GroupByIgnore => None | |
case _: GroupByColumnNumber => None | |
case gbv@GroupByValue(_: ConstantValue, _) if findGroupByTypeColumn(gbv).isEmpty => None | |
case _ => | |
val (exposed, expr) = | |
gb match { | |
case GroupByColumnName(name, _, Some(expression)) => (Some(name), expression) | |
case GroupByValue(_, expression) => (None, expression) |
OlderNewer