quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zuyu <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #58: QUICKSTEP-20: Supported Window Aggrega...
Date Mon, 18 Jul 2016 21:20:38 GMT
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/58#discussion_r71232229
  
    --- Diff: expressions/window_aggregation/tests/WindowAggregationHandleAvg_unittest.cpp
---
    @@ -0,0 +1,398 @@
    +/**
    + *   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.
    + *   limitations under the License.
    + **/
    +
    +#include <cstddef>
    +#include <cstdint>
    +#include <memory>
    +#include <vector>
    +
    +#include "catalog/CatalogTypedefs.hpp"
    +#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
    +#include "expressions/window_aggregation/WindowAggregateFunctionFactory.hpp"
    +#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
    +#include "expressions/window_aggregation/WindowAggregationHandleAvg.hpp"
    +#include "expressions/window_aggregation/WindowAggregationID.hpp"
    +#include "storage/ValueAccessor.hpp"
    +#include "types/CharType.hpp"
    +#include "types/DateOperatorOverloads.hpp"
    +#include "types/DatetimeIntervalType.hpp"
    +#include "types/DoubleType.hpp"
    +#include "types/FloatType.hpp"
    +#include "types/IntType.hpp"
    +#include "types/IntervalLit.hpp"
    +#include "types/LongType.hpp"
    +#include "types/Type.hpp"
    +#include "types/TypeFactory.hpp"
    +#include "types/TypeID.hpp"
    +#include "types/TypedValue.hpp"
    +#include "types/VarCharType.hpp"
    +#include "types/YearMonthIntervalType.hpp"
    +#include "types/containers/ColumnVector.hpp"
    +#include "types/containers/ColumnVectorsValueAccessor.hpp"
    +
    +#include "gtest/gtest.h"
    +
    +namespace quickstep {
    +
    +namespace {
    +
    +  constexpr int kNumTuples = 100;
    +  constexpr int kNumTuplesPerPartition = 8;
    +  constexpr int kNullInterval = 25;
    +  constexpr int kNumPreceding = 2;
    +  constexpr int kNumFollowing = 2;
    +
    +}  // namespace
    +
    +// Attribute value could be null if set true.
    +class WindowAggregationHandleAvgTest : public::testing::TestWithParam<bool> {
    + protected:
    +  // Handle initialization.
    +  void initializeHandle(const Type &argument_type) {
    +    const WindowAggregateFunction &function =
    +        WindowAggregateFunctionFactory::Get(WindowAggregationID::kAvg);
    +    std::vector<const Type*> partition_key_types(1, &TypeFactory::GetType(kInt,
false));
    +    handle_avg_.reset(function.createHandle(std::vector<const Type*>(1, &argument_type),
    +                                            std::move(partition_key_types)));
    +  }
    +
    +  // Test canApplyToTypes().
    +  static bool CanApplyToTypesTest(TypeID typeID) {
    +    const Type &type = (typeID == kChar || typeID == kVarChar) ?
    +        TypeFactory::GetType(typeID, static_cast<std::size_t>(10)) :
    +        TypeFactory::GetType(typeID);
    +
    +    return WindowAggregateFunctionFactory::Get(WindowAggregationID::kAvg).canApplyToTypes(
    +        std::vector<const Type*>(1, &type));
    +  }
    +
    +  // Test resultTypeForArgumentTypes().
    +  static bool ResultTypeForArgumentTypesTest(TypeID input_type_id,
    +                                            TypeID output_type_id) {
    --- End diff --
    
    Code style: add one whitespace indentation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message