Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Jan 3, 2025
1 parent 977d957 commit 00d0e50
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ struct AggregateFunctionCollectListData<StringRef, HasLimit> {

data->insert_range_from(
*rhs.data, 0,
std::min(assert_cast<size_t, TypeCheckOnRelease::DISABLE>(max_size - size()),
std::min(assert_cast<size_t, TypeCheckOnRelease::DISABLE>(static_cast<size_t>(max_size - size())),
rhs.size()));
} else {
data->insert_range_from(*rhs.data, 0, rhs.size());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.

// The cases is copied from https://github.com/trinodb/trino/tree/master
// /testing/trino-product-tests/src/main/resources/sql-tests/testcases/window_functions
// and modified by Doris.

import java.util.concurrent.atomic.AtomicReference
import java.util.stream.Collectors

suite("test_test_windowSpecificationABA") {

def uuid = UUID.randomUUID().toString()
def result = new AtomicReference()
profile(uuid) {
run {
result.set(sql """
select /* ${uuid} */ *
from (
select
suppkey, orderkey, partkey,
round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_quantity_A,
round(sum(quantity) over (partition by orderkey order by shipdate rows between UNBOUNDED preceding and CURRENT ROW), 3) sum_quantity_B,
round(sum(discount) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_discount_A
from tpch_tiny_lineitem where (partkey = 272 or partkey = 273) and suppkey > 50
)as t
order by suppkey, orderkey
"""
)
}

check { p, e ->
logger.info("result:\n${result.get().stream().map {it.toString() }.collect(Collectors.joining("\n"))}")
if (e != null) {
throw e
} else {
logger.info("profile:\n${p}")
throw new IllegalStateException("OK")
}
}
}
}

0 comments on commit 00d0e50

Please sign in to comment.