Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1825,4 +1825,106 @@ function <<PCT.test, PCTRelationQualifier.relation>> meta::pure::functions::rela
' 3,5\n'+
' 4,9\n'+
'#', $res->sort([~val->ascending()])->toString());
}
}

function
<<PCT.test, PCTRelationQualifier.relation, PCTRelationQualifier.olap>>
{
doc.doc='Tests project followed by extend with an OLAP lead inside a nested if with adjust.'
}
meta::pure::functions::relation::tests::composition::testProjectExtendNestedIfLeadAdjust<T|m>(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1]
{
let expr = {
| #TDS
id:Integer[1],fromDate:Date[1],toDate:Date[1]
1,2026-01-07T00:00:00.000000000+0000,2026-01-08T00:00:00.000000000+0000
1,2026-01-08T00:00:00.000000000+0000,2026-01-10T00:00:00.000000000+0000
1,2026-01-09T00:00:00.000000000+0000,2026-01-09T00:00:00.000000000+0000
1,2026-01-10T00:00:00.000000000+0000,9999-12-31T00:00:00.000000000+0000
#
->project(
~[
grp: x|$x.id,
dateSeq: x|$x.fromDate,
endDate: x|$x.toDate,
startDate: x|$x.fromDate
]
)->extend(
over(~[grp], [~dateSeq->ascending()]),
~[
endDateSeq: {p, w, r|if(
$r.endDate ==
$p->lead(
$r
).startDate,
|$p->lead(
$r
).dateSeq,
|if(
$r.startDate != $r.endDate,
|$r.endDate,
|$r.dateSeq->adjust(
1,
DurationUnit.SECONDS
)
)
)->cast(@Date) }
]
)
};

let res = $f->eval($expr);

assertEquals( '#TDS\n'+
' grp,dateSeq,endDate,startDate,endDateSeq\n'+
' 1,2026-01-07T00:00:00.000+0000,2026-01-08T00:00:00.000+0000,2026-01-07T00:00:00.000+0000,2026-01-08T00:00:00.000+0000\n'+
' 1,2026-01-08T00:00:00.000+0000,2026-01-10T00:00:00.000+0000,2026-01-08T00:00:00.000+0000,2026-01-10T00:00:00.000+0000\n'+
' 1,2026-01-09T00:00:00.000+0000,2026-01-09T00:00:00.000+0000,2026-01-09T00:00:00.000+0000,2026-01-09T00:00:01.000+0000\n'+
' 1,2026-01-10T00:00:00.000+0000,1816-03-29T05:56:08.067+0000,2026-01-10T00:00:00.000+0000,1816-03-29T05:56:08.067+0000\n'+
'#', $res->sort(~dateSeq->ascending())->toString());
}

function
<<PCT.test, PCTRelationQualifier.relation, PCTRelationQualifier.olap>>
{
doc.doc='Tests extend with an OLAP lead inside an if with adjust using a derived offset.'
}
meta::pure::functions::relation::tests::composition::testExtendLeadAdjustDerivedOffset<T|m>(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1]
{
let expr = {
| #TDS
id:Integer[1],fromDate:Date[1],seq:Integer[1],toDate:Date[1]
1, 2026-01-07T00:00:00.000000000+0000,1,2026-01-07T00:00:00.000000000+0000
1, 2026-01-07T00:00:00.000000000+0000,2,2026-01-08T00:00:00.000000000+0000
1, 2026-01-08T00:00:00.000000000+0000,1,2026-01-08T00:00:00.000000000+0000
1, 2026-01-08T00:00:00.000000000+0000,2,9999-12-31T00:00:00.000000000+0000
#
->extend(over(~[id, fromDate], [~fromDate->ascending(), ~seq->ascending()]),
~[
toDateSeq: {p, w, r|if(
$r.fromDate ==
$r.toDate,
|$p->lead(
$r
).fromDate->toOne()->cast(@Date)->adjust(
$p->lead(
$r
).seq->toOne() - 1,
DurationUnit.SECONDS
),
|$r.toDate
)->cast(@Date) }
]
)
};

let res = $f->eval($expr);

assertEquals( '#TDS\n'+
' id,fromDate,seq,toDate,toDateSeq\n'+
' 1,2026-01-07T00:00:00.000+0000,1,2026-01-07T00:00:00.000+0000,2026-01-07T00:00:01.000+0000\n'+
' 1,2026-01-07T00:00:00.000+0000,2,2026-01-08T00:00:00.000+0000,2026-01-08T00:00:00.000+0000\n'+
' 1,2026-01-08T00:00:00.000+0000,1,2026-01-08T00:00:00.000+0000,2026-01-08T00:00:01.000+0000\n'+
' 1,2026-01-08T00:00:00.000+0000,2,1816-03-29T05:56:08.067+0000,1816-03-29T05:56:08.067+0000\n'+
'#', $res->sort([~fromDate->ascending(), ~seq->ascending()])->toString());
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public class Test_Deephaven_RelationFunctions_PCT extends PCTReportConfiguration
one("meta::pure::functions::relation::tests::composition::test_Extend_Sort_Extend_Select_Function_1__Boolean_1_", "\"Match failure: PlatformClusteredValueSpecificationObject instanceOf PlatformClusteredValueSpecification\""),
one("meta::pure::functions::relation::tests::composition::testFilterArithmeticComparisonExpression_Function_1__Boolean_1_", "\"function not supported yet: meta::pure::functions::boolean::lessThan_Number_1__Number_1__Boolean_1_\""),
one("meta::pure::functions::relation::tests::composition::testNestedJoinArithmeticComparisonExpression_Function_1__Boolean_1_", "\"function not supported yet: meta::pure::functions::relation::project_Relation_1__FuncColSpecArray_1__Relation_1_\""),
one("meta::pure::functions::relation::tests::composition::testExtendLeadAdjustDerivedOffset_Function_1__Boolean_1_", "\"function not supported yet: meta::pure::functions::lang::cast_Any_m__T_1__T_m_\""),
one("meta::pure::functions::relation::tests::composition::testProjectExtendNestedIfLeadAdjust_Function_1__Boolean_1_", "\"Match failure: PlatformClusteredValueSpecificationObject instanceOf PlatformClusteredValueSpecification\""),

one("meta::pure::functions::relation::tests::concatenate::testSimpleConcatenateShared_Function_1__Boolean_1_", "\"function not supported yet: meta::pure::functions::relation::concatenate_Relation_1__Relation_1__Relation_1_\""),
one("meta::pure::functions::relation::tests::concatenate::testSimpleConcatenate_MultipleExpressions_Function_1__Boolean_1_", "\"Match failure: LambdaFunctionObject instanceOf LambdaFunction\""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public class Test_JAVA_RelationFunction_PCT extends PCTReportConfiguration
one("meta::pure::functions::relation::tests::composition::test_Extend_Sort_Project_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::relation::tests::composition::test_Extend_Sort_Extend_Select_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::relation::tests::composition::testFilterArithmeticComparisonExpression_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::relation::tests::composition::testNestedJoinArithmeticComparisonExpression_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature)
one("meta::pure::functions::relation::tests::composition::testNestedJoinArithmeticComparisonExpression_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::relation::tests::composition::testExtendLeadAdjustDerivedOffset_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::relation::tests::composition::testProjectExtendNestedIfLeadAdjust_Function_1__Boolean_1_", "\"Instance of type 'meta::pure::metamodel::relation::TDS' can't be translated\"", AdapterQualifier.unsupportedFeature)
);

public static Test suite()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class Test_Relational_ClickHouse_RelationFunctions_PCT extends PCTReportC
one("meta::pure::functions::relation::tests::composition::testCoalesceInPreFilter_Function_1__Boolean_1_", "Error while executing: Create Table leSchema.OptionalPersonTypeForCompositionTests"),
one("meta::pure::functions::relation::tests::composition::testMultiCoalesceInProject_Function_1__Boolean_1_", "Error while executing: Create Table leSchema.OptionalPersonTypeForCompositionTests"),
one("meta::pure::functions::relation::tests::composition::testProjectNumbersPlusTimesMinus_Function_1__Boolean_1_", "Error while executing: Create Table leSchema.SimpleNumbersTypeForCompositionTests"),
one("meta::pure::functions::relation::tests::composition::testExtendLeadAdjustDerivedOffset_Function_1__Boolean_1_", "Aggregate function with name 'lead' does not exist."),
one("meta::pure::functions::relation::tests::composition::testProjectExtendNestedIfLeadAdjust_Function_1__Boolean_1_", "Aggregate function with name 'lead' does not exist."),

// CumulativeDistribution
one("meta::pure::functions::relation::tests::cumulativeDistribution::testOLAPWithPartitionAndOrderCummulativeDistribution_Function_1__Boolean_1_", "Aggregate function with name 'cume_dist' does not exist"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class Test_Relational_Databricks_EssentialFunctions_PCT extends PCTReport
//contains
one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Parameter to IN operation isn't a literal!\"", AdapterQualifier.unsupportedFeature),
one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "no viable alternative at input '->meta::pure::functions::collection::contains(meta::pure::functions::collection::tests::contains::ClassWithoutEquality.all()->meta::pure::functions::multiplicity::toOne(),meta::pure::functions::collection::tests::contains::comparator(a:meta::pure::functions::collection::tests::contains::ClassWithoutEquality[1],'"),
one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "[DATATYPE_MISMATCH.DATA_DIFF_TYPES] Cannot resolve \"(1 IN (1, 2, 5, 2, a, true, to_date(2014-02-01), c))\" due to data type mismatch: Input to `in` should all be the same type, but it's [\"INT\", \"INT\", \"INT\", \"INT\", \"INT\", \"STRING\", \"STRING\", \"DATE\", \"STRING\"]. SQLSTATE: 42K09; line 1 pos 9"),

//drop
one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"[unsupported-api] The function 'array_drop' (state: [Select, false]) is not supported yet\""),
Expand Down Expand Up @@ -296,7 +297,7 @@ public class Test_Relational_Databricks_EssentialFunctions_PCT extends PCTReport
one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "Cannot cast a collection of size 2 to multiplicity [1]"),
one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "Cannot cast a collection of size 0 to multiplicity [1]"),
one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'"),
one("meta::pure::functions::string::tests::toString::testFloatToStringWithNegativeExponent_Function_1__Boolean_1_", "\"\nexpected: '0.000000013421'\nactual: '1.3421E-8'\"")
one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "[CAST_INVALID_INPUT] The value '3.14159d' of the type \"STRING\" cannot be cast to \"DECIMAL(10,0)\" because it is malformed.")
);

public static Test suite()
Expand Down
Loading
Loading