diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f82fa9ef361..b0ce5f93b26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,37 @@ repos: - - repo: https://github.com/timothycrosley/isort - rev: 5.0.7 + - repo: https://github.com/pycqa/isort + rev: 5.6.4 hooks: - id: isort + alias: isort-cudf + name: isort-cudf + args: ["--settings-path=python/cudf/setup.cfg"] + files: python/cudf/.* + exclude: __init__.py$ + types: [text] + types_or: [python, cython, pyi] + - id: isort + alias: isort-cudf-kafka + name: isort-cudf-kafka + args: ["--settings-path=python/cudf_kafka/setup.cfg"] + files: python/cudf_kafka/.* + types: [text] + types_or: [python, cython] + - id: isort + alias: isort-custreamz + name: isort-custreamz + args: ["--settings-path=python/custreamz/setup.cfg"] + files: python/custreamz/.* + - id: isort + alias: isort-dask-cudf + name: isort-dask-cudf + args: ["--settings-path=python/dask_cudf/setup.cfg"] + files: python/dask_cudf/.* - repo: https://github.com/ambv/black rev: 19.10b0 hooks: - id: black + files: python/.* - repo: https://gitlab.com/pycqa/flake8 rev: 3.8.3 hooks: @@ -14,10 +39,7 @@ repos: alias: flake8 name: flake8 args: ["--config=python/.flake8"] - types: [python] - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 - hooks: + files: python/.*\.py$ - id: flake8 alias: flake8-cython name: flake8-cython diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 8235f9de0e5..d14c54be8e9 100755 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -14,28 +14,40 @@ LANG=C.UTF-8 . /opt/conda/etc/profile.d/conda.sh conda activate rapids -# Run isort and get results/return code -ISORT=`isort --check-only python/**/*.py` -ISORT_RETVAL=$? +# Run isort-cudf and get results/return code +ISORT_CUDF=`isort python/cudf --check-only --skip-glob *.pyx --settings-path=python/cudf/setup.cfg 2>&1` +ISORT_CUDF_RETVAL=$? + +# Run isort-cudf-kafka and get results/return code +ISORT_CUDF_KAFKA=`isort python/cudf_kafka --check-only --settings-path=python/cudf_kafka/setup.cfg 2>&1` +ISORT_CUDF_KAFKA_RETVAL=$? + +# Run isort-custreamz and get results/return code +ISORT_CUSTREAMZ=`isort python/custreamz --check-only --settings-path=python/custreamz/setup.cfg 2>&1` +ISORT_CUSTREAMZ_RETVAL=$? + +# Run isort-dask-cudf and get results/return code +ISORT_DASK_CUDF=`isort python/dask_cudf --check-only --settings-path=python/dask_cudf/setup.cfg 2>&1` +ISORT_DASK_CUDF_RETVAL=$? # Run black and get results/return code -BLACK=`black --check python` +BLACK=`black --check python 2>&1` BLACK_RETVAL=$? # Run flake8 and get results/return code -FLAKE=`flake8 --config=python/.flake8 python` +FLAKE=`flake8 --config=python/.flake8 python 2>&1` FLAKE_RETVAL=$? # Run flake8-cython and get results/return code -FLAKE_CYTHON=`flake8 --config=python/.flake8.cython` +FLAKE_CYTHON=`flake8 --config=python/.flake8.cython 2>&1` FLAKE_CYTHON_RETVAL=$? # Run mypy and get results/return code -MYPY_CUDF=`mypy --config=python/cudf/setup.cfg python/cudf/cudf` +MYPY_CUDF=`mypy --config=python/cudf/setup.cfg python/cudf/cudf 2>&1` MYPY_CUDF_RETVAL=$? # Run pydocstyle and get results/return code -PYDOCSTYLE=`pydocstyle --config=python/.flake8 python` +PYDOCSTYLE=`pydocstyle --config=python/.flake8 python 2>&1` PYDOCSTYLE_RETVAL=$? # Run clang-format and check for a consistent code format @@ -43,12 +55,36 @@ CLANG_FORMAT=`python cpp/scripts/run-clang-format.py 2>&1` CLANG_FORMAT_RETVAL=$? # Output results if failure otherwise show pass -if [ "$ISORT_RETVAL" != "0" ]; then - echo -e "\n\n>>>> FAILED: isort style check; begin output\n\n" - echo -e "$ISORT" - echo -e "\n\n>>>> FAILED: isort style check; end output\n\n" +if [ "$ISORT_CUDF_RETVAL" != "0" ]; then + echo -e "\n\n>>>> FAILED: isort-cudf style check; begin output\n\n" + echo -e "$ISORT_CUDF" + echo -e "\n\n>>>> FAILED: isort-cudf style check; end output\n\n" +else + echo -e "\n\n>>>> PASSED: isort-cudf style check\n\n" +fi + +if [ "$ISORT_CUDF_KAFKA_RETVAL" != "0" ]; then + echo -e "\n\n>>>> FAILED: isort-cudf-kafka style check; begin output\n\n" + echo -e "$ISORT_CUDF_KAFKA" + echo -e "\n\n>>>> FAILED: isort-cudf-kafka style check; end output\n\n" +else + echo -e "\n\n>>>> PASSED: isort-cudf-kafka style check\n\n" +fi + +if [ "$ISORT_CUSTREAMZ_RETVAL" != "0" ]; then + echo -e "\n\n>>>> FAILED: isort-custreamz style check; begin output\n\n" + echo -e "$ISORT_CUSTREAMZ" + echo -e "\n\n>>>> FAILED: isort-custreamz style check; end output\n\n" +else + echo -e "\n\n>>>> PASSED: isort-custreamz style check\n\n" +fi + +if [ "$ISORT_DASK_CUDF_RETVAL" != "0" ]; then + echo -e "\n\n>>>> FAILED: isort-dask-cudf style check; begin output\n\n" + echo -e "$ISORT_DASK_CUDF" + echo -e "\n\n>>>> FAILED: isort-dask-cudf style check; end output\n\n" else - echo -e "\n\n>>>> PASSED: isort style check\n\n" + echo -e "\n\n>>>> PASSED: isort-dask-cudf style check\n\n" fi if [ "$BLACK_RETVAL" != "0" ]; then @@ -104,7 +140,11 @@ HEADER_META=`ci/checks/headers_test.sh` HEADER_META_RETVAL=$? echo -e "$HEADER_META" -RETVALS=($ISORT_RETVAL $BLACK_RETVAL $FLAKE_RETVAL $FLAKE_CYTHON_RETVAL $PYDOCSTYLE_RETVAL $CLANG_FORMAT_RETVAL $HEADER_META_RETVAL $MYPY_CUDF_RETVAL) +RETVALS=( + $ISORT_CUDF_RETVAL $ISORT_CUDF_KAFKA_RETVAL $ISORT_CUSTREAMZ_RETVAL $ISORT_DASK_CUDF_RETVAL + $BLACK_RETVAL $FLAKE_RETVAL $FLAKE_CYTHON_RETVAL $PYDOCSTYLE_RETVAL $CLANG_FORMAT_RETVAL + $HEADER_META_RETVAL $MYPY_CUDF_RETVAL +) IFS=$'\n' RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1` diff --git a/cpp/libcudf_kafka/include/cudf_kafka/kafka_consumer.hpp b/cpp/libcudf_kafka/include/cudf_kafka/kafka_consumer.hpp index 254d1150418..d752acbceaf 100644 --- a/cpp/libcudf_kafka/include/cudf_kafka/kafka_consumer.hpp +++ b/cpp/libcudf_kafka/include/cudf_kafka/kafka_consumer.hpp @@ -49,7 +49,7 @@ class kafka_consumer : public cudf::io::datasource { * @param configs key/value pairs of librdkafka configurations that will be * passed to the librdkafka client */ - kafka_consumer(std::map const &configs); + kafka_consumer(std::map const& configs); /** * @brief Instantiate a Kafka consumer object. Documentation for librdkafka configurations can be @@ -66,13 +66,13 @@ class kafka_consumer : public cudf::io::datasource { * before batch_timeout, a smaller subset will be returned * @param delimiter optional delimiter to insert into the output between kafka messages, Ex: "\n" */ - kafka_consumer(std::map const &configs, - std::string const &topic_name, + kafka_consumer(std::map const& configs, + std::string const& topic_name, int partition, int64_t start_offset, int64_t end_offset, int batch_timeout, - std::string const &delimiter); + std::string const& delimiter); /** * @brief Returns a buffer with a subset of data from Kafka Topic @@ -100,7 +100,7 @@ class kafka_consumer : public cudf::io::datasource { * * @return The number of bytes read (can be smaller than size) */ - size_t host_read(size_t offset, size_t size, uint8_t *dst) override; + size_t host_read(size_t offset, size_t size, uint8_t* dst) override; /** * @brief Commits an offset to a specified Kafka Topic/Partition instance @@ -112,7 +112,7 @@ class kafka_consumer : public cudf::io::datasource { * @param[in] offset Offset that should be set for the topic/partition pair * */ - void commit_offset(std::string const &topic, int partition, int64_t offset); + void commit_offset(std::string const& topic, int partition, int64_t offset); /** * @brief Retrieve the watermark offset values for a topic/partition @@ -124,7 +124,7 @@ class kafka_consumer : public cudf::io::datasource { * the latest value will be retrieved from the Kafka broker by making a network * request. */ - std::map get_watermark_offset(std::string const &topic, + std::map get_watermark_offset(std::string const& topic, int partition, int timeout, bool cached); @@ -144,7 +144,7 @@ class kafka_consumer : public cudf::io::datasource { * * @return Latest offset for the specified topic/partition pair */ - int64_t get_committed_offset(std::string const &topic, int partition); + int64_t get_committed_offset(std::string const& topic, int partition); /** * @brief Query the Kafka broker for the list of Topic partitions for a Topic. If no topic is @@ -189,7 +189,7 @@ class kafka_consumer : public cudf::io::datasource { std::string buffer; private: - RdKafka::ErrorCode update_consumer_topic_partition_assignment(std::string const &topic, + RdKafka::ErrorCode update_consumer_topic_partition_assignment(std::string const& topic, int partition, int64_t offset); diff --git a/cpp/libcudf_kafka/src/kafka_consumer.cpp b/cpp/libcudf_kafka/src/kafka_consumer.cpp index 472b9f035c3..a76d6b0a985 100644 --- a/cpp/libcudf_kafka/src/kafka_consumer.cpp +++ b/cpp/libcudf_kafka/src/kafka_consumer.cpp @@ -24,10 +24,10 @@ namespace io { namespace external { namespace kafka { -kafka_consumer::kafka_consumer(std::map const &configs) +kafka_consumer::kafka_consumer(std::map const& configs) : kafka_conf(RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL)) { - for (auto const &key_value : configs) { + for (auto const& key_value : configs) { std::string error_string; CUDF_EXPECTS(RdKafka::Conf::ConfResult::CONF_OK == kafka_conf->set(key_value.first, key_value.second, error_string), @@ -44,13 +44,13 @@ kafka_consumer::kafka_consumer(std::map const &configs RdKafka::KafkaConsumer::create(kafka_conf.get(), errstr)); } -kafka_consumer::kafka_consumer(std::map const &configs, - std::string const &topic_name, +kafka_consumer::kafka_consumer(std::map const& configs, + std::string const& topic_name, int partition, int64_t start_offset, int64_t end_offset, int batch_timeout, - std::string const &delimiter) + std::string const& delimiter) : topic_name(topic_name), partition(partition), start_offset(start_offset), @@ -60,7 +60,7 @@ kafka_consumer::kafka_consumer(std::map const &configs { kafka_conf = std::unique_ptr(RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL)); - for (auto const &key_value : configs) { + for (auto const& key_value : configs) { std::string error_string; CUDF_EXPECTS(RdKafka::Conf::ConfResult::CONF_OK == kafka_conf->set(key_value.first, key_value.second, error_string), @@ -85,10 +85,10 @@ std::unique_ptr kafka_consumer::host_read(size_t o { if (offset > buffer.size()) { return 0; } size = std::min(size, buffer.size() - offset); - return std::make_unique((uint8_t *)buffer.data() + offset, size); + return std::make_unique((uint8_t*)buffer.data() + offset, size); } -size_t kafka_consumer::host_read(size_t offset, size_t size, uint8_t *dst) +size_t kafka_consumer::host_read(size_t offset, size_t size, uint8_t* dst) { if (offset > buffer.size()) { return 0; } auto const read_size = std::min(size, buffer.size() - offset); @@ -102,9 +102,9 @@ size_t kafka_consumer::size() const { return buffer.size(); } * Change the TOPPAR assignment for this consumer instance */ RdKafka::ErrorCode kafka_consumer::update_consumer_topic_partition_assignment( - std::string const &topic, int partition, int64_t offset) + std::string const& topic, int partition, int64_t offset) { - std::vector topic_partitions; + std::vector topic_partitions; topic_partitions.push_back(RdKafka::TopicPartition::create(topic, partition, offset)); return consumer.get()->assign(topic_partitions); } @@ -121,7 +121,7 @@ void kafka_consumer::consume_to_buffer() consumer->consume((end - std::chrono::steady_clock::now()).count())}; if (msg->err() == RdKafka::ErrorCode::ERR_NO_ERROR) { - buffer.append(static_cast(msg->payload())); + buffer.append(static_cast(msg->payload())); buffer.append(delimiter); messages_read++; } else if (msg->err() == RdKafka::ErrorCode::ERR__PARTITION_EOF) { @@ -134,15 +134,15 @@ void kafka_consumer::consume_to_buffer() std::map kafka_consumer::current_configs() { std::map configs; - std::list *dump = kafka_conf->dump(); + std::list* dump = kafka_conf->dump(); for (auto it = dump->begin(); it != dump->end(); std::advance(it, 2)) configs.insert({*it, *std::next(it)}); return configs; } -int64_t kafka_consumer::get_committed_offset(std::string const &topic, int partition) +int64_t kafka_consumer::get_committed_offset(std::string const& topic, int partition) { - std::vector toppar_list; + std::vector toppar_list; toppar_list.push_back(RdKafka::TopicPartition::create(topic, partition)); // Query Kafka to populate the TopicPartitions with the desired offsets @@ -160,7 +160,7 @@ std::map> kafka_consumer::list_topics(std::str auto spec_topic = std::unique_ptr( RdKafka::Topic::create(consumer.get(), specific_topic, nullptr, errstr)); - RdKafka::Metadata *md; + RdKafka::Metadata* md; CUDF_EXPECTS( RdKafka::ERR_NO_ERROR == consumer->metadata(spec_topic == nullptr, spec_topic.get(), &md, default_timeout), @@ -169,11 +169,11 @@ std::map> kafka_consumer::list_topics(std::str }(); std::map> topic_parts; - for (auto const &topic : *(metadata->topics())) { - auto &part_ids = topic_parts[topic->topic()]; - auto const &parts = *(topic->partitions()); + for (auto const& topic : *(metadata->topics())) { + auto& part_ids = topic_parts[topic->topic()]; + auto const& parts = *(topic->partitions()); std::transform( - parts.cbegin(), parts.cend(), std::back_inserter(part_ids), [](auto const &part) { + parts.cbegin(), parts.cend(), std::back_inserter(part_ids), [](auto const& part) { return part->id(); }); } @@ -181,7 +181,7 @@ std::map> kafka_consumer::list_topics(std::str return topic_parts; } -std::map kafka_consumer::get_watermark_offset(std::string const &topic, +std::map kafka_consumer::get_watermark_offset(std::string const& topic, int partition, int timeout, bool cached) @@ -212,10 +212,10 @@ std::map kafka_consumer::get_watermark_offset(std::string return results; } -void kafka_consumer::commit_offset(std::string const &topic, int partition, int64_t offset) +void kafka_consumer::commit_offset(std::string const& topic, int partition, int64_t offset) { - std::vector partitions_; - RdKafka::TopicPartition *toppar = RdKafka::TopicPartition::create(topic, partition, offset); + std::vector partitions_; + RdKafka::TopicPartition* toppar = RdKafka::TopicPartition::create(topic, partition, offset); CUDF_EXPECTS(toppar != nullptr, "RdKafka failed to create TopicPartition"); toppar->set_offset(offset); partitions_.push_back(toppar); diff --git a/cpp/libcudf_kafka/tests/kafka_consumer_tests.cpp b/cpp/libcudf_kafka/tests/kafka_consumer_tests.cpp index 0f88d0b2564..fa3d7d887aa 100644 --- a/cpp/libcudf_kafka/tests/kafka_consumer_tests.cpp +++ b/cpp/libcudf_kafka/tests/kafka_consumer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ #include #include "cudf_kafka/kafka_consumer.hpp" -#include #include +#include namespace kafka = cudf::io::external::kafka; diff --git a/cpp/scripts/run-clang-format.py b/cpp/scripts/run-clang-format.py index c32e984278f..178bf2f0c78 100755 --- a/cpp/scripts/run-clang-format.py +++ b/cpp/scripts/run-clang-format.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2020, NVIDIA CORPORATION. +# Copyright (c) 2019-2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,10 +29,10 @@ DEFAULT_DIRS = [ "cpp/benchmarks", "cpp/include", - "cpp/include/cudf", - "cpp/include/nvtext", + "cpp/libcudf_kafka", "cpp/src", "cpp/tests", + "java/src/main/native", ] diff --git a/java/src/main/native/include/jni_utils.hpp b/java/src/main/native/include/jni_utils.hpp index 3ce136dda19..4b6696e3911 100644 --- a/java/src/main/native/include/jni_utils.hpp +++ b/java/src/main/native/include/jni_utils.hpp @@ -243,21 +243,13 @@ template class nativ return data_ptr; } - const N_TYPE *const begin() const { - return data(); - } + const N_TYPE *const begin() const { return data(); } - N_TYPE *begin() { - return data(); - } + N_TYPE *begin() { return data(); } - const N_TYPE *const end() const { - return data() + size(); - } + const N_TYPE *const end() const { return data() + size(); } - N_TYPE *end() { - return data() + size(); - } + N_TYPE *end() { return data() + size(); } const J_ARRAY_TYPE get_jArray() const { return orig; } @@ -315,7 +307,7 @@ template class native_jpointerArray { int size() const noexcept { return wrapped.size(); } - T *operator[](int index) const { + T *operator[](int index) const { if (data() == NULL) { throw_java_exception(env, NPE_CLASS, "pointer is NULL"); } @@ -754,8 +746,8 @@ inline void jni_cuda_check(JNIEnv *const env, cudaError_t cuda_status) { if (cudaErrorMemoryAllocation == cudaPeekAtLastError()) { \ cudaGetLastError(); \ } \ - auto what = std::string("Could not allocate native memory: ") + \ - (e.what() == nullptr ? "" : e.what()); \ + auto what = \ + std::string("Could not allocate native memory: ") + (e.what() == nullptr ? "" : e.what()); \ JNI_CHECK_THROW_NEW(env, cudf::jni::OOM_CLASS, what.c_str(), ret_val); \ } \ catch (const std::exception &e) { \ @@ -763,5 +755,4 @@ inline void jni_cuda_check(JNIEnv *const env, cudaError_t cuda_status) { JNI_CHECK_THROW_NEW(env, class_name, e.what(), ret_val); \ } -#define CATCH_STD(env, ret_val) \ - CATCH_STD_CLASS(env, cudf::jni::CUDF_ERROR_CLASS, ret_val) +#define CATCH_STD(env, ret_val) CATCH_STD_CLASS(env, cudf::jni::CUDF_ERROR_CLASS, ret_val) diff --git a/java/src/main/native/src/AggregationJni.cpp b/java/src/main/native/src/AggregationJni.cpp index e189006ddd9..45fca9be40d 100644 --- a/java/src/main/native/src/AggregationJni.cpp +++ b/java/src/main/native/src/AggregationJni.cpp @@ -20,8 +20,7 @@ extern "C" { -JNIEXPORT void JNICALL Java_ai_rapids_cudf_Aggregation_close(JNIEnv *env, - jclass class_object, +JNIEXPORT void JNICALL Java_ai_rapids_cudf_Aggregation_close(JNIEnv *env, jclass class_object, jlong ptr) { try { cudf::jni::auto_set_device(env); @@ -51,7 +50,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createNoParamAgg(JNIEnv case 3: // MAX ret = cudf::make_max_aggregation(); break; - //case 4 COUNT + // case 4 COUNT case 5: // ANY ret = cudf::make_any_aggregation(); break; @@ -84,9 +83,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createNoParamAgg(JNIEnv // case 18: COLLECT_LIST // case 19: COLLECT_SET // case 20: MERGE_LISTS - case 20: - ret = cudf::make_merge_lists_aggregation(); - break; + case 20: ret = cudf::make_merge_lists_aggregation(); break; // case 21: MERGE_SETS // case 22: LEAD // case 23: LAG @@ -107,9 +104,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createNthAgg(JNIEnv *env try { cudf::jni::auto_set_device(env); - std::unique_ptr ret = - cudf::make_nth_element_aggregation(offset, - include_nulls ? cudf::null_policy::INCLUDE : cudf::null_policy::EXCLUDE); + std::unique_ptr ret = cudf::make_nth_element_aggregation( + offset, include_nulls ? cudf::null_policy::INCLUDE : cudf::null_policy::EXCLUDE); return reinterpret_cast(ret.release()); } CATCH_STD(env, 0); @@ -117,8 +113,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createNthAgg(JNIEnv *env JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createDdofAgg(JNIEnv *env, jclass class_object, - jint kind, - jint ddof) { + jint kind, jint ddof) { try { cudf::jni::auto_set_device(env); @@ -184,8 +179,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createQuantAgg(JNIEnv *e JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createLeadLagAgg(JNIEnv *env, jclass class_object, - jint kind, - jint offset) { + jint kind, jint offset) { try { cudf::jni::auto_set_device(env); @@ -205,9 +199,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createLeadLagAgg(JNIEnv CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createCollectListAgg(JNIEnv *env, - jclass class_object, - jboolean include_nulls) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createCollectListAgg( + JNIEnv *env, jclass class_object, jboolean include_nulls) { try { cudf::jni::auto_set_device(env); cudf::null_policy policy = @@ -231,9 +224,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createCollectSetAgg(JNIE nulls_equal ? cudf::null_equality::EQUAL : cudf::null_equality::UNEQUAL; cudf::nan_equality nan_equality = nans_equal ? cudf::nan_equality::ALL_EQUAL : cudf::nan_equality::UNEQUAL; - std::unique_ptr ret = cudf::make_collect_set_aggregation(null_policy, - null_equality, - nan_equality); + std::unique_ptr ret = + cudf::make_collect_set_aggregation(null_policy, null_equality, nan_equality); return reinterpret_cast(ret.release()); } CATCH_STD(env, 0); @@ -249,8 +241,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Aggregation_createMergeSetsAgg(JNIEn nulls_equal ? cudf::null_equality::EQUAL : cudf::null_equality::UNEQUAL; cudf::nan_equality nan_equality = nans_equal ? cudf::nan_equality::ALL_EQUAL : cudf::nan_equality::UNEQUAL; - std::unique_ptr ret = cudf::make_merge_sets_aggregation(null_equality, - nan_equality); + std::unique_ptr ret = + cudf::make_merge_sets_aggregation(null_equality, nan_equality); return reinterpret_cast(ret.release()); } CATCH_STD(env, 0); diff --git a/java/src/main/native/src/ColumnViewJni.cpp b/java/src/main/native/src/ColumnViewJni.cpp index 38c38d853ac..83ba4d56d68 100644 --- a/java/src/main/native/src/ColumnViewJni.cpp +++ b/java/src/main/native/src/ColumnViewJni.cpp @@ -23,9 +23,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -49,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -56,14 +59,12 @@ #include #include #include -#include +#include #include #include #include -#include -#include -#include #include + #include "cudf/types.hpp" #include "cudf_jni_apis.hpp" @@ -86,10 +87,9 @@ std::size_t calc_device_memory_size(cudf::column_view const &view) { total += cudf::size_of(dtype) * view.size(); } - return std::accumulate(view.child_begin(), view.child_end(), total, - [](std::size_t t, cudf::column_view const &v) { - return t + calc_device_memory_size(v); - }); + return std::accumulate( + view.child_begin(), view.child_end(), total, + [](std::size_t t, cudf::column_view const &v) { return t + calc_device_memory_size(v); }); } } // anonymous namespace @@ -163,16 +163,15 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_replaceNullsPolicy(JNIEnv try { cudf::jni::auto_set_device(env); cudf::column_view col = *reinterpret_cast(j_col); - std::unique_ptr result = cudf::replace_nulls(col, - is_preceding ? cudf::replace_policy::PRECEDING : cudf::replace_policy::FOLLOWING); + std::unique_ptr result = cudf::replace_nulls( + col, is_preceding ? cudf::replace_policy::PRECEDING : cudf::replace_policy::FOLLOWING); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_ifElseVV(JNIEnv *env, jclass, - jlong j_pred_vec, - jlong j_true_vec, + jlong j_pred_vec, jlong j_true_vec, jlong j_false_vec) { JNI_NULL_CHECK(env, j_pred_vec, "predicate column is null", 0); JNI_NULL_CHECK(env, j_true_vec, "true column is null", 0); @@ -189,8 +188,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_ifElseVV(JNIEnv *env, jcl } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_ifElseVS(JNIEnv *env, jclass, - jlong j_pred_vec, - jlong j_true_vec, + jlong j_pred_vec, jlong j_true_vec, jlong j_false_scalar) { JNI_NULL_CHECK(env, j_pred_vec, "predicate column is null", 0); JNI_NULL_CHECK(env, j_true_vec, "true column is null", 0); @@ -243,24 +241,21 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_ifElseSS(JNIEnv *env, jcl CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getElement(JNIEnv *env, jclass, - jlong from, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getElement(JNIEnv *env, jclass, jlong from, jint index) { JNI_NULL_CHECK(env, from, "from column is null", 0); try { cudf::jni::auto_set_device(env); auto from_vec = reinterpret_cast(from); - std::unique_ptr result = - cudf::get_element(*from_vec, index); + std::unique_ptr result = cudf::get_element(*from_vec, index); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_reduce(JNIEnv *env, jclass, - jlong j_col_view, - jlong j_agg, - jint j_dtype, jint scale) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_reduce(JNIEnv *env, jclass, jlong j_col_view, + jlong j_agg, jint j_dtype, + jint scale) { JNI_NULL_CHECK(env, j_col_view, "column view is null", 0); JNI_NULL_CHECK(env, j_agg, "aggregation is null", 0); try { @@ -275,10 +270,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_reduce(JNIEnv *env, jclas CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_scan(JNIEnv *env, jclass, - jlong j_col_view, - jlong j_agg, - jboolean is_inclusive, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_scan(JNIEnv *env, jclass, jlong j_col_view, + jlong j_agg, jboolean is_inclusive, jboolean include_nulls) { JNI_NULL_CHECK(env, j_col_view, "column view is null", 0); JNI_NULL_CHECK(env, j_agg, "aggregation is null", 0); @@ -287,16 +280,14 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_scan(JNIEnv *env, jclass, auto col = reinterpret_cast(j_col_view); auto agg = reinterpret_cast(j_agg); - std::unique_ptr result = cudf::scan(*col, agg->clone(), - is_inclusive ? cudf::scan_type::INCLUSIVE : cudf::scan_type::EXCLUSIVE, - include_nulls ? cudf::null_policy::INCLUDE : cudf::null_policy::EXCLUDE); + std::unique_ptr result = cudf::scan( + *col, agg->clone(), is_inclusive ? cudf::scan_type::INCLUSIVE : cudf::scan_type::EXCLUSIVE, + include_nulls ? cudf::null_policy::INCLUDE : cudf::null_policy::EXCLUDE); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); } - - JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_quantile(JNIEnv *env, jclass clazz, jlong input_column, jint quantile_method, @@ -317,9 +308,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_quantile(JNIEnv *env, jcl } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_rollingWindow( - JNIEnv *env, jclass clazz, jlong input_col, jlong default_output_col, - jint min_periods, jlong agg_ptr, jint preceding, - jint following, jlong preceding_col, jlong following_col) { + JNIEnv *env, jclass clazz, jlong input_col, jlong default_output_col, jint min_periods, + jlong agg_ptr, jint preceding, jint following, jlong preceding_col, jlong following_col) { JNI_NULL_CHECK(env, input_col, "native handle is null", 0); JNI_NULL_CHECK(env, agg_ptr, "aggregation handle is null", 0); @@ -330,27 +320,28 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_rollingWindow( reinterpret_cast(default_output_col); cudf::column_view *n_preceding_col = reinterpret_cast(preceding_col); cudf::column_view *n_following_col = reinterpret_cast(following_col); - cudf::rolling_aggregation * agg = dynamic_cast(reinterpret_cast(agg_ptr)); + cudf::rolling_aggregation *agg = + dynamic_cast(reinterpret_cast(agg_ptr)); JNI_ARG_CHECK(env, agg != nullptr, "aggregation is not an instance of rolling_aggregation", 0); std::unique_ptr ret; if (n_default_output_col != nullptr) { if (n_preceding_col != nullptr && n_following_col != nullptr) { - CUDF_FAIL("A default output column is not currently supported with variable length preceding and following"); - //ret = cudf::rolling_window(*n_input_col, *n_default_output_col, + CUDF_FAIL("A default output column is not currently supported with variable length " + "preceding and following"); + // ret = cudf::rolling_window(*n_input_col, *n_default_output_col, // *n_preceding_col, *n_following_col, min_periods, agg); } else { - ret = cudf::rolling_window(*n_input_col, *n_default_output_col, - preceding, following, min_periods, *agg); + ret = cudf::rolling_window(*n_input_col, *n_default_output_col, preceding, following, + min_periods, *agg); } } else { if (n_preceding_col != nullptr && n_following_col != nullptr) { - ret = cudf::rolling_window(*n_input_col, *n_preceding_col, *n_following_col, - min_periods, *agg); + ret = cudf::rolling_window(*n_input_col, *n_preceding_col, *n_following_col, min_periods, + *agg); } else { - ret = cudf::rolling_window(*n_input_col, preceding, following, min_periods, - *agg); + ret = cudf::rolling_window(*n_input_col, preceding, following, min_periods, *agg); } } return reinterpret_cast(ret.release()); @@ -422,8 +413,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_listContains(JNIEnv *env, } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_listContainsColumn(JNIEnv *env, jclass, - jlong column_view, - jlong lookup_key_cv) { + jlong column_view, + jlong lookup_key_cv) { JNI_NULL_CHECK(env, column_view, "column is null", 0); JNI_NULL_CHECK(env, lookup_key_cv, "lookup column is null", 0); try { @@ -509,7 +500,7 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_ColumnView_split(JNIEnv *env, j cudf::jni::native_jlongArray n_result(env, result.size()); for (size_t i = 0; i < result.size(); i++) { - cudf::column_view const * c = new cudf::column_view(result[i]); + cudf::column_view const *c = new cudf::column_view(result[i]); n_result[i] = reinterpret_cast(c); } return n_result.get_jArray(); @@ -556,8 +547,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_byteCount(JNIEnv *env, jc CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_findAndReplaceAll(JNIEnv *env, - jclass clazz, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_findAndReplaceAll(JNIEnv *env, jclass clazz, jlong old_values_handle, jlong new_values_handle, jlong input_handle) { @@ -644,23 +634,21 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_unaryOperation(JNIEnv *en CATCH_STD(env, 0); } - -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_round(JNIEnv *env, jclass, - jlong input_ptr, jint decimal_places, - jint rounding_method) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_round(JNIEnv *env, jclass, jlong input_ptr, + jint decimal_places, + jint rounding_method) { JNI_NULL_CHECK(env, input_ptr, "input is null", 0); - try { - cudf::jni::auto_set_device(env); - cudf::column_view *input = reinterpret_cast(input_ptr); - cudf::rounding_method method = static_cast(rounding_method); - std::unique_ptr ret = cudf::round(*input, decimal_places, method); - return reinterpret_cast(ret.release()); - } - CATCH_STD(env, 0); -} - -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_year(JNIEnv *env, jclass, - jlong input_ptr) { + try { + cudf::jni::auto_set_device(env); + cudf::column_view *input = reinterpret_cast(input_ptr); + cudf::rounding_method method = static_cast(rounding_method); + std::unique_ptr ret = cudf::round(*input, decimal_places, method); + return reinterpret_cast(ret.release()); + } + CATCH_STD(env, 0); +} + +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_year(JNIEnv *env, jclass, jlong input_ptr) { JNI_NULL_CHECK(env, input_ptr, "input is null", 0); try { cudf::jni::auto_set_device(env); @@ -671,8 +659,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_year(JNIEnv *env, jclass, CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_month(JNIEnv *env, jclass, - jlong input_ptr) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_month(JNIEnv *env, jclass, jlong input_ptr) { JNI_NULL_CHECK(env, input_ptr, "input is null", 0); try { cudf::jni::auto_set_device(env); @@ -694,8 +681,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_day(JNIEnv *env, jclass, CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_hour(JNIEnv *env, jclass, - jlong input_ptr) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_hour(JNIEnv *env, jclass, jlong input_ptr) { JNI_NULL_CHECK(env, input_ptr, "input is null", 0); try { cudf::jni::auto_set_device(env); @@ -766,9 +752,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_dayOfYear(JNIEnv *env, jc CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclass, - jlong handle, jint type, - jint scale) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclass, jlong handle, + jint type, jint scale) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { cudf::jni::auto_set_device(env); @@ -781,13 +766,9 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclas } if (n_data_type.id() == cudf::type_id::STRING) { switch (column->type().id()) { - case cudf::type_id::BOOL8: - result = cudf::strings::from_booleans(*column); - break; + case cudf::type_id::BOOL8: result = cudf::strings::from_booleans(*column); break; case cudf::type_id::FLOAT32: - case cudf::type_id::FLOAT64: - result = cudf::strings::from_floats(*column); - break; + case cudf::type_id::FLOAT64: result = cudf::strings::from_floats(*column); break; case cudf::type_id::INT8: case cudf::type_id::UINT8: case cudf::type_id::INT16: @@ -795,24 +776,16 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclas case cudf::type_id::INT32: case cudf::type_id::UINT32: case cudf::type_id::INT64: - case cudf::type_id::UINT64: - result = cudf::strings::from_integers(*column); - break; + case cudf::type_id::UINT64: result = cudf::strings::from_integers(*column); break; case cudf::type_id::DECIMAL32: - case cudf::type_id::DECIMAL64: - result = cudf::strings::from_fixed_point(*column); - break; + case cudf::type_id::DECIMAL64: result = cudf::strings::from_fixed_point(*column); break; default: JNI_THROW_NEW(env, "java/lang/IllegalArgumentException", "Invalid data type", 0); } } else if (column->type().id() == cudf::type_id::STRING) { switch (n_data_type.id()) { - case cudf::type_id::BOOL8: - result = cudf::strings::to_booleans(*column); - break; + case cudf::type_id::BOOL8: result = cudf::strings::to_booleans(*column); break; case cudf::type_id::FLOAT32: - case cudf::type_id::FLOAT64: - result = cudf::strings::to_floats(*column, n_data_type); - break; + case cudf::type_id::FLOAT64: result = cudf::strings::to_floats(*column, n_data_type); break; case cudf::type_id::INT8: case cudf::type_id::UINT8: case cudf::type_id::INT16: @@ -835,30 +808,26 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclas // "reinterpret" casting will be supported via https://github.com/rapidsai/cudf/pull/5358 if (n_data_type.id() == cudf::type_id::TIMESTAMP_DAYS) { if (column->type().id() != cudf::type_id::INT32) { - JNI_THROW_NEW(env, "java/lang/IllegalArgumentException", "Numeric cast to TIMESTAMP_DAYS requires INT32", 0); + JNI_THROW_NEW(env, "java/lang/IllegalArgumentException", + "Numeric cast to TIMESTAMP_DAYS requires INT32", 0); } } else { if (column->type().id() != cudf::type_id::INT64) { - JNI_THROW_NEW(env, "java/lang/IllegalArgumentException", "Numeric cast to non-day timestamp requires INT64", 0); + JNI_THROW_NEW(env, "java/lang/IllegalArgumentException", + "Numeric cast to non-day timestamp requires INT64", 0); } } cudf::data_type duration_type = cudf::jni::timestamp_to_duration(n_data_type); - cudf::column_view duration_view = cudf::column_view(duration_type, - column->size(), - column->head(), - column->null_mask(), - column->null_count()); + cudf::column_view duration_view = cudf::column_view( + duration_type, column->size(), column->head(), column->null_mask(), column->null_count()); result = cudf::cast(duration_view, n_data_type); } else if (cudf::is_timestamp(column->type()) && cudf::is_numeric(n_data_type)) { // This is a temporary workaround to allow Java to cast from timestamp types to integral types // without forcing an intermediate duration column to be manifested. Ultimately this style of // "reinterpret" casting will be supported via https://github.com/rapidsai/cudf/pull/5358 cudf::data_type duration_type = cudf::jni::timestamp_to_duration(column->type()); - cudf::column_view duration_view = cudf::column_view(duration_type, - column->size(), - column->head(), - column->null_mask(), - column->null_count()); + cudf::column_view duration_view = cudf::column_view( + duration_type, column->size(), column->head(), column->null_mask(), column->null_count()); result = cudf::cast(duration_view, n_data_type); } else { result = cudf::cast(*column, n_data_type); @@ -868,9 +837,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_castTo(JNIEnv *env, jclas CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitCastTo(JNIEnv *env, jclass, - jlong handle, jint type, - jint scale) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitCastTo(JNIEnv *env, jclass, jlong handle, + jint type, jint scale) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { cudf::jni::auto_set_device(env); @@ -916,7 +884,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringTimestampToTimestam } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isTimestamp(JNIEnv *env, jclass, - jlong handle, jstring formatObj) { + jlong handle, + jstring formatObj) { JNI_NULL_CHECK(env, handle, "column is null", 0); JNI_NULL_CHECK(env, formatObj, "format is null", 0); @@ -926,8 +895,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isTimestamp(JNIEnv *env, cudf::column_view *column = reinterpret_cast(handle); cudf::strings_column_view strings_column(*column); - std::unique_ptr result = cudf::strings::is_timestamp( - strings_column, format.get()); + std::unique_ptr result = + cudf::strings::is_timestamp(strings_column, format.get()); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); @@ -965,8 +934,7 @@ JNIEXPORT jboolean JNICALL Java_ai_rapids_cudf_ColumnView_containsScalar(JNIEnv CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_containsVector(JNIEnv *env, - jobject j_object, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_containsVector(JNIEnv *env, jobject j_object, jlong j_haystack_handle, jlong j_needle_handle) { JNI_NULL_CHECK(env, j_haystack_handle, "haystack vector is null", false); @@ -1016,8 +984,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringStartWith(JNIEnv *e CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringEndWith(JNIEnv *env, - jobject j_object, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringEndWith(JNIEnv *env, jobject j_object, jlong j_view_handle, jlong comp_string) { JNI_NULL_CHECK(env, j_view_handle, "column is null", false); @@ -1035,8 +1002,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringEndWith(JNIEnv *env CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringContains(JNIEnv *env, - jobject j_object, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringContains(JNIEnv *env, jobject j_object, jlong j_view_handle, jlong comp_string) { JNI_NULL_CHECK(env, j_view_handle, "column is null", false); @@ -1104,8 +1070,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_binaryOpVV(JNIEnv *env, j cudf::data_type n_data_type = cudf::jni::make_data_type(out_dtype, scale); cudf::binary_operator op = static_cast(int_op); - std::unique_ptr result = cudf::binary_operation( - *lhs, *rhs, op, n_data_type); + std::unique_ptr result = cudf::binary_operation(*lhs, *rhs, op, n_data_type); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); @@ -1136,8 +1101,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_binaryOpVS(JNIEnv *env, j cudf::data_type n_data_type = cudf::jni::make_data_type(out_dtype, scale); cudf::binary_operator op = static_cast(int_op); - std::unique_ptr result = cudf::binary_operation( - *lhs, *rhs, op, n_data_type); + std::unique_ptr result = cudf::binary_operation(*lhs, *rhs, op, n_data_type); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); @@ -1182,8 +1146,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_substringColumn(JNIEnv *e JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_substringLocate(JNIEnv *env, jclass, jlong column_view, - jlong substring, - jint start, jint end) { + jlong substring, jint start, + jint end) { JNI_NULL_CHECK(env, column_view, "column is null", 0); JNI_NULL_CHECK(env, substring, "target string scalar is null", 0); try { @@ -1200,8 +1164,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_substringLocate(JNIEnv *e JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringReplace(JNIEnv *env, jclass, jlong column_view, - jlong target, - jlong replace) { + jlong target, jlong replace) { JNI_NULL_CHECK(env, column_view, "column is null", 0); JNI_NULL_CHECK(env, target, "target string scalar is null", 0); JNI_NULL_CHECK(env, replace, "replace string scalar is null", 0); @@ -1250,11 +1213,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_mapContains(JNIEnv *env, CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringReplaceWithBackrefs(JNIEnv *env, - jclass, - jlong column_view, - jstring patternObj, - jstring replaceObj) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringReplaceWithBackrefs( + JNIEnv *env, jclass, jlong column_view, jstring patternObj, jstring replaceObj) { JNI_NULL_CHECK(env, column_view, "column is null", 0); JNI_NULL_CHECK(env, patternObj, "pattern string is null", 0); @@ -1266,8 +1226,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringReplaceWithBackrefs cudf::jni::native_jstring ss_pattern(env, patternObj); cudf::jni::native_jstring ss_replace(env, replaceObj); - std::unique_ptr result = cudf::strings::replace_with_backrefs( - scv, ss_pattern.get(), ss_replace.get()); + std::unique_ptr result = + cudf::strings::replace_with_backrefs(scv, ss_pattern.get(), ss_replace.get()); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); @@ -1289,11 +1249,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_zfill(JNIEnv *env, jclass CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_pad(JNIEnv *env, - jclass, - jlong column_view, - jint j_width, - jint j_side, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_pad(JNIEnv *env, jclass, jlong column_view, + jint j_width, jint j_side, jstring fill_char) { JNI_NULL_CHECK(env, column_view, "column is null", 0); @@ -1392,11 +1349,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_normalizeNANsAndZeros(JNI CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitwiseMergeAndSetValidity(JNIEnv *env, - jobject j_object, - jlong base_column, - jlongArray column_handles, - jint bin_op) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitwiseMergeAndSetValidity( + JNIEnv *env, jobject j_object, jlong base_column, jlongArray column_handles, jint bin_op) { JNI_NULL_CHECK(env, base_column, "base column native handle is null", 0); JNI_NULL_CHECK(env, column_handles, "array of column handles is null", 0); try { @@ -1418,15 +1372,14 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitwiseMergeAndSetValidit cudf::table_view *input_table = new cudf::table_view(column_views); cudf::binary_operator op = static_cast(bin_op); - switch(op) { + switch (op) { case cudf::binary_operator::BITWISE_AND: copy->set_null_mask(cudf::bitmask_and(*input_table)); break; case cudf::binary_operator::BITWISE_OR: copy->set_null_mask(cudf::bitmask_or(*input_table)); break; - default: - JNI_THROW_NEW(env, cudf::jni::ILLEGAL_ARG_CLASS, "Unsupported merge operation", 0); + default: JNI_THROW_NEW(env, cudf::jni::ILLEGAL_ARG_CLASS, "Unsupported merge operation", 0); } return reinterpret_cast(copy.release()); @@ -1439,11 +1392,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_bitwiseMergeAndSetValidit // should typically only be called from the CudfColumn inner class. //////// -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeCudfColumnView(JNIEnv *env, - jclass, jint j_type, - jint scale, jlong j_data, - jlong j_data_size, - jlong j_offset, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeCudfColumnView( + JNIEnv *env, jclass, jint j_type, jint scale, jlong j_data, jlong j_data_size, jlong j_offset, jlong j_valid, jint j_null_count, jint size, jlongArray j_children) { try { @@ -1461,7 +1411,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeCudfColumnView(JNIEnv if (n_type == cudf::type_id::STRING) { if (size == 0) { - ret.reset(new cudf::column_view(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0)); + ret.reset( + new cudf::column_view(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0)); } else { JNI_NULL_CHECK(env, j_offset, "offset is null", 0); // This must be kept in sync with how string columns are created @@ -1485,20 +1436,21 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeCudfColumnView(JNIEnv offsets_size = size + 1; offsets = reinterpret_cast(j_offset); } - cudf::column_view offsets_column(cudf::data_type{cudf::type_id::INT32}, offsets_size, offsets); + cudf::column_view offsets_column(cudf::data_type{cudf::type_id::INT32}, offsets_size, + offsets); ret.reset(new cudf::column_view(cudf::data_type{cudf::type_id::LIST}, size, nullptr, valid, - j_null_count, 0, {offsets_column, *children[0]})); - } else if (n_type == cudf::type_id::STRUCT) { - JNI_NULL_CHECK(env, j_children, "children of a struct are null", 0); - cudf::jni::native_jpointerArray children(env, j_children); - std::vector children_vector(children.size()); - for (int i = 0; i < children.size(); i++) { - children_vector[i] = *children[i]; - } - ret.reset(new cudf::column_view(cudf::data_type{cudf::type_id::STRUCT}, size, nullptr, valid, - j_null_count, 0, children_vector)); - } else { - ret.reset(new cudf::column_view(n_data_type, size, data, valid, j_null_count)); + j_null_count, 0, {offsets_column, *children[0]})); + } else if (n_type == cudf::type_id::STRUCT) { + JNI_NULL_CHECK(env, j_children, "children of a struct are null", 0); + cudf::jni::native_jpointerArray children(env, j_children); + std::vector children_vector(children.size()); + for (int i = 0; i < children.size(); i++) { + children_vector[i] = *children[i]; + } + ret.reset(new cudf::column_view(cudf::data_type{cudf::type_id::STRUCT}, size, nullptr, valid, + j_null_count, 0, children_vector)); + } else { + ret.reset(new cudf::column_view(n_data_type, size, data, valid, j_null_count)); } return reinterpret_cast(ret.release()); @@ -1506,8 +1458,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeCudfColumnView(JNIEnv CATCH_STD(env, 0); } -JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeId(JNIEnv *env, - jobject j_object, +JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeId(JNIEnv *env, jobject j_object, jlong handle) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { @@ -1518,8 +1469,7 @@ JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeId(JNIEnv *en CATCH_STD(env, 0); } -JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeScale(JNIEnv *env, - jclass, +JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeScale(JNIEnv *env, jclass, jlong handle) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { @@ -1530,8 +1480,7 @@ JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeTypeScale(JNIEnv CATCH_STD(env, 0); } -JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeRowCount(JNIEnv *env, - jclass, +JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeRowCount(JNIEnv *env, jclass, jlong handle) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { @@ -1578,7 +1527,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeDataAddress(JNIE cudf::column_view data_view = view.chars(); result = reinterpret_cast(data_view.data()); } - } else if(column->type().id() != cudf::type_id::LIST && column->type().id() != cudf::type_id::STRUCT) { + } else if (column->type().id() != cudf::type_id::LIST && + column->type().id() != cudf::type_id::STRUCT) { result = reinterpret_cast(column->data()); } return result; @@ -1599,7 +1549,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeDataLength(JNIEn cudf::column_view data_view = view.chars(); result = data_view.size(); } - } else if(column->type().id() != cudf::type_id::LIST && column->type().id() != cudf::type_id::STRUCT) { + } else if (column->type().id() != cudf::type_id::LIST && + column->type().id() != cudf::type_id::STRUCT) { result = cudf::size_of(column->type()) * column->size(); } return result; @@ -1611,45 +1562,49 @@ JNIEXPORT jint JNICALL Java_ai_rapids_cudf_ColumnView_getNativeNumChildren(JNIEn jobject j_object, jlong handle) { - JNI_NULL_CHECK(env, handle, "native handle is null", 0); - try { - cudf::jni::auto_set_device(env); - cudf::column_view *column = reinterpret_cast(handle); - // Strings has children(offsets and chars) but not a nested child() we care about here. - if (column->type().id() == cudf::type_id::STRING) { - return 0; - } else if (column->type().id() == cudf::type_id::LIST) { - // first child is always offsets in lists which we do not want to count here - return static_cast(column->num_children() - 1); - } else if (column->type().id() == cudf::type_id::STRUCT) { - return static_cast(column->num_children()); - } else { - return 0; - } + JNI_NULL_CHECK(env, handle, "native handle is null", 0); + try { + cudf::jni::auto_set_device(env); + cudf::column_view *column = reinterpret_cast(handle); + // Strings has children(offsets and chars) but not a nested child() we care about here. + if (column->type().id() == cudf::type_id::STRING) { + return 0; + } else if (column->type().id() == cudf::type_id::LIST) { + // first child is always offsets in lists which we do not want to count here + return static_cast(column->num_children() - 1); + } else if (column->type().id() == cudf::type_id::STRUCT) { + return static_cast(column->num_children()); + } else { + return 0; } - CATCH_STD(env, 0); - + } + CATCH_STD(env, 0); } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getChildCvPointer(JNIEnv *env, jobject j_object, - jlong handle, jint child_index) { - JNI_NULL_CHECK(env, handle, "native handle is null", 0); - try { - cudf::jni::auto_set_device(env); - cudf::column_view *column = reinterpret_cast(handle); - if (column->type().id() == cudf::type_id::LIST) { - std::unique_ptr view = std::make_unique(*column); - // first child is always offsets which we do not want to get from this call - std::unique_ptr next_view = std::make_unique(column->child(1 + child_index)); - return reinterpret_cast(next_view.release()); - } else { - std::unique_ptr view = std::make_unique(*column); - std::unique_ptr next_view = std::make_unique(column->child(child_index)); - return reinterpret_cast(next_view.release()); - } + jlong handle, + jint child_index) { + JNI_NULL_CHECK(env, handle, "native handle is null", 0); + try { + cudf::jni::auto_set_device(env); + cudf::column_view *column = reinterpret_cast(handle); + if (column->type().id() == cudf::type_id::LIST) { + std::unique_ptr view = + std::make_unique(*column); + // first child is always offsets which we do not want to get from this call + std::unique_ptr next_view = + std::make_unique(column->child(1 + child_index)); + return reinterpret_cast(next_view.release()); + } else { + std::unique_ptr view = + std::make_unique(*column); + std::unique_ptr next_view = + std::make_unique(column->child(child_index)); + return reinterpret_cast(next_view.release()); } - CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeOffsetsAddress(JNIEnv *env, jclass, @@ -1702,8 +1657,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeOffsetsLength(JN CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidityAddress(JNIEnv *env, - jclass, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidityAddress(JNIEnv *env, jclass, jlong handle) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { @@ -1714,8 +1668,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidityAddress( CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidityLength(JNIEnv *env, - jclass, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidityLength(JNIEnv *env, jclass, jlong handle) { JNI_NULL_CHECK(env, handle, "native handle is null", 0); try { @@ -1742,13 +1695,13 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getNativeValidPointerSize JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getDeviceMemorySize(JNIEnv *env, jclass, jlong handle) { - JNI_NULL_CHECK(env, handle, "native handle is null", 0); - try { - cudf::jni::auto_set_device(env); - auto view = reinterpret_cast(handle); - return calc_device_memory_size(*view); - } - CATCH_STD(env, 0); + JNI_NULL_CHECK(env, handle, "native handle is null", 0); + try { + cudf::jni::auto_set_device(env); + auto view = reinterpret_cast(handle); + return calc_device_memory_size(*view); + } + CATCH_STD(env, 0); } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_clamper(JNIEnv *env, jobject j_object, @@ -1824,7 +1777,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_makeStructView(JNIEnv *en children_vector[i] = *children[i]; } ret.reset(new cudf::column_view(cudf::data_type{cudf::type_id::STRUCT}, row_count, nullptr, - nullptr, 0, 0, children_vector)); + nullptr, 0, 0, children_vector)); return reinterpret_cast(ret.release()); } @@ -1855,7 +1808,6 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_nansToNulls(JNIEnv *env, CATCH_STD(env, 0) } - JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isFloat(JNIEnv *env, jobject j_object, jlong handle) { @@ -1885,8 +1837,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isInteger(JNIEnv *env, jo } JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isIntegerWithType(JNIEnv *env, jobject, - jlong handle, - jint j_dtype, + jlong handle, jint j_dtype, jint scale) { JNI_NULL_CHECK(env, handle, "native view handle is null", 0) @@ -1901,7 +1852,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_isIntegerWithType(JNIEnv CATCH_STD(env, 0) } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_copyColumnViewToCV(JNIEnv *env, jobject j_object, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_copyColumnViewToCV(JNIEnv *env, + jobject j_object, jlong handle) { JNI_NULL_CHECK(env, handle, "native view handle is null", 0) @@ -1916,15 +1868,16 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_copyColumnViewToCV(JNIEnv CATCH_STD(env, 0) } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getJSONObject(JNIEnv *env, jclass, - jlong j_view_handle, jlong j_scalar_handle) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getJSONObject(JNIEnv *env, jclass, + jlong j_view_handle, + jlong j_scalar_handle) { - JNI_NULL_CHECK(env, j_view_handle, "view cannot be null", 0); - JNI_NULL_CHECK(env, j_scalar_handle, "path cannot be null", 0); + JNI_NULL_CHECK(env, j_view_handle, "view cannot be null", 0); + JNI_NULL_CHECK(env, j_scalar_handle, "path cannot be null", 0); try { cudf::jni::auto_set_device(env); - cudf::column_view* n_column_view = reinterpret_cast(j_view_handle); + cudf::column_view *n_column_view = reinterpret_cast(j_view_handle); cudf::strings_column_view n_strings_col_view(*n_column_view); cudf::string_scalar *n_scalar_path = reinterpret_cast(j_scalar_handle); @@ -1933,66 +1886,57 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_getJSONObject(JNIEnv *env return reinterpret_cast(result.release()); } CATCH_STD(env, 0) - } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringConcatenationListElementsSepCol(JNIEnv *env, jclass, - jlong column_handle, - jlong sep_handle, - jlong separator_narep, - jlong col_narep, - jboolean separate_nulls, - jboolean empty_string_output_if_empty_list) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringConcatenationListElementsSepCol( + JNIEnv *env, jclass, jlong column_handle, jlong sep_handle, jlong separator_narep, + jlong col_narep, jboolean separate_nulls, jboolean empty_string_output_if_empty_list) { JNI_NULL_CHECK(env, column_handle, "column handle is null", 0); JNI_NULL_CHECK(env, sep_handle, "separator column handle is null", 0); JNI_NULL_CHECK(env, separator_narep, "separator narep string scalar object is null", 0); JNI_NULL_CHECK(env, col_narep, "column narep string scalar object is null", 0); try { cudf::jni::auto_set_device(env); - const auto& separator_narep_scalar = *reinterpret_cast(separator_narep); - const auto& col_narep_scalar = *reinterpret_cast(col_narep); - auto null_policy = separate_nulls ? cudf::strings::separator_on_nulls::YES - : cudf::strings::separator_on_nulls::NO; - auto empty_list_output = - empty_string_output_if_empty_list ? cudf::strings::output_if_empty_list::EMPTY_STRING - : cudf::strings::output_if_empty_list::NULL_ELEMENT; + const auto &separator_narep_scalar = *reinterpret_cast(separator_narep); + const auto &col_narep_scalar = *reinterpret_cast(col_narep); + auto null_policy = separate_nulls ? cudf::strings::separator_on_nulls::YES : + cudf::strings::separator_on_nulls::NO; + auto empty_list_output = empty_string_output_if_empty_list ? + cudf::strings::output_if_empty_list::EMPTY_STRING : + cudf::strings::output_if_empty_list::NULL_ELEMENT; cudf::column_view *column = reinterpret_cast(sep_handle); cudf::strings_column_view strings_column(*column); cudf::column_view *cv = reinterpret_cast(column_handle); cudf::lists_column_view lcv(*cv); std::unique_ptr result = - cudf::strings::join_list_elements(lcv, strings_column, separator_narep_scalar, - col_narep_scalar, null_policy, empty_list_output); + cudf::strings::join_list_elements(lcv, strings_column, separator_narep_scalar, + col_narep_scalar, null_policy, empty_list_output); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringConcatenationListElements(JNIEnv *env, jclass, - jlong column_handle, - jlong separator, - jlong narep, - jboolean separate_nulls, - jboolean empty_string_output_if_empty_list) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_stringConcatenationListElements( + JNIEnv *env, jclass, jlong column_handle, jlong separator, jlong narep, jboolean separate_nulls, + jboolean empty_string_output_if_empty_list) { JNI_NULL_CHECK(env, column_handle, "column handle is null", 0); JNI_NULL_CHECK(env, separator, "separator string scalar object is null", 0); JNI_NULL_CHECK(env, narep, "separator narep string scalar object is null", 0); try { cudf::jni::auto_set_device(env); - const auto& separator_scalar = *reinterpret_cast(separator); - const auto& narep_scalar = *reinterpret_cast(narep); - auto null_policy = separate_nulls ? cudf::strings::separator_on_nulls::YES - : cudf::strings::separator_on_nulls::NO; - auto empty_list_output = - empty_string_output_if_empty_list ? cudf::strings::output_if_empty_list::EMPTY_STRING - : cudf::strings::output_if_empty_list::NULL_ELEMENT; + const auto &separator_scalar = *reinterpret_cast(separator); + const auto &narep_scalar = *reinterpret_cast(narep); + auto null_policy = separate_nulls ? cudf::strings::separator_on_nulls::YES : + cudf::strings::separator_on_nulls::NO; + auto empty_list_output = empty_string_output_if_empty_list ? + cudf::strings::output_if_empty_list::EMPTY_STRING : + cudf::strings::output_if_empty_list::NULL_ELEMENT; cudf::column_view *cv = reinterpret_cast(column_handle); cudf::lists_column_view lcv(*cv); - std::unique_ptr result = - cudf::strings::join_list_elements(lcv, separator_scalar, narep_scalar, - null_policy, empty_list_output); + std::unique_ptr result = cudf::strings::join_list_elements( + lcv, separator_scalar, narep_scalar, null_policy, empty_list_output); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); diff --git a/java/src/main/native/src/ContiguousTableJni.cpp b/java/src/main/native/src/ContiguousTableJni.cpp index 352256af450..f592d80834c 100644 --- a/java/src/main/native/src/ContiguousTableJni.cpp +++ b/java/src/main/native/src/ContiguousTableJni.cpp @@ -93,7 +93,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ContiguousTable_createPackedMetadata auto data_addr = reinterpret_cast(j_buffer_addr); auto data_size = static_cast(j_buffer_length); auto metadata_ptr = - new cudf::packed_columns::metadata(cudf::pack_metadata(*table, data_addr, data_size)); + new cudf::packed_columns::metadata(cudf::pack_metadata(*table, data_addr, data_size)); return reinterpret_cast(metadata_ptr); } CATCH_STD(env, 0); diff --git a/java/src/main/native/src/CudaJni.cpp b/java/src/main/native/src/CudaJni.cpp index 987ff87f8ac..4f1239a8966 100644 --- a/java/src/main/native/src/CudaJni.cpp +++ b/java/src/main/native/src/CudaJni.cpp @@ -15,6 +15,7 @@ */ #include + #include "jni_utils.hpp" namespace { @@ -49,7 +50,7 @@ void auto_set_device(JNIEnv *env) { } /** Fills all the bytes in the buffer 'buf' with 'value'. */ -void device_memset_async(JNIEnv *env, rmm::device_buffer& buf, char value) { +void device_memset_async(JNIEnv *env, rmm::device_buffer &buf, char value) { cudaError_t cuda_status = cudaMemsetAsync((void *)buf.data(), value, buf.size()); jni_cuda_check(env, cuda_status); } diff --git a/java/src/main/native/src/HostMemoryBufferNativeUtilsJni.cpp b/java/src/main/native/src/HostMemoryBufferNativeUtilsJni.cpp index 4a38516db92..f9e05d27798 100644 --- a/java/src/main/native/src/HostMemoryBufferNativeUtilsJni.cpp +++ b/java/src/main/native/src/HostMemoryBufferNativeUtilsJni.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,32 +14,26 @@ * limitations under the License. */ -#include - -#include -#include #include #include +#include #include #include +#include +#include + #include "jni_utils.hpp" extern "C" { -JNIEXPORT jobject JNICALL -Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_wrapRangeInBuffer(JNIEnv *env, jclass, - jlong addr, - jlong len) { +JNIEXPORT jobject JNICALL Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_wrapRangeInBuffer( + JNIEnv *env, jclass, jlong addr, jlong len) { return env->NewDirectByteBuffer(reinterpret_cast(addr), len); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_mmap(JNIEnv* env, jclass, - jstring jpath, - jint mode, - jlong offset, - jlong length) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_mmap( + JNIEnv *env, jclass, jstring jpath, jint mode, jlong offset, jlong length) { JNI_NULL_CHECK(env, jpath, "path is null", 0); JNI_ARG_CHECK(env, (mode == 0 || mode == 1), "bad mode value", 0); try { @@ -50,29 +44,31 @@ Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_mmap(JNIEnv* env, jclass, cudf::jni::throw_java_exception(env, "java/io/IOException", strerror(errno)); } - void* address = mmap(NULL, length, - (mode == 0) ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset); + void *address = mmap(NULL, length, (mode == 0) ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED, + fd, offset); if (address == MAP_FAILED) { - char const* error_msg = strerror(errno); + char const *error_msg = strerror(errno); close(fd); cudf::jni::throw_java_exception(env, "java/io/IOException", error_msg); } close(fd); return reinterpret_cast(address); - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_munmap(JNIEnv* env, jclass, - jlong address, jlong length) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_HostMemoryBufferNativeUtils_munmap(JNIEnv *env, jclass, + jlong address, + jlong length) { JNI_NULL_CHECK(env, address, "address is NULL", ); try { - int rc = munmap(reinterpret_cast(address), length); + int rc = munmap(reinterpret_cast(address), length); if (rc == -1) { cudf::jni::throw_java_exception(env, "java/io/IOException", strerror(errno)); } - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } } // extern "C" diff --git a/java/src/main/native/src/NvcompJni.cpp b/java/src/main/native/src/NvcompJni.cpp index 9ef3b1f958a..0e34d2856f5 100644 --- a/java/src/main/native/src/NvcompJni.cpp +++ b/java/src/main/native/src/NvcompJni.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,7 @@ constexpr char const *UNSUPPORTED_CLASS = "java/lang/UnsupportedOperationExcepti void check_nvcomp_status(JNIEnv *env, nvcompError_t status) { switch (status) { - case nvcompSuccess: - break; + case nvcompSuccess: break; case nvcompErrorInvalidValue: cudf::jni::throw_java_exception(env, ILLEGAL_ARG_CLASS, "nvcomp invalid value"); break; @@ -50,10 +49,8 @@ void check_nvcomp_status(JNIEnv *env, nvcompError_t status) { extern "C" { -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetMetadata(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jlong jstream) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetMetadata( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jlong jstream) { try { cudf::jni::auto_set_device(env); void *metadata_ptr; @@ -62,121 +59,114 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetMetadata(JNIEnv *env, jclass, &metadata_ptr, stream); check_nvcomp_status(env, status); return reinterpret_cast(metadata_ptr); - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressDestroyMetadata(JNIEnv *env, jclass, - jlong metadata_ptr) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressDestroyMetadata( + JNIEnv *env, jclass, jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); nvcompDecompressDestroyMetadata(reinterpret_cast(metadata_ptr)); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetTempSize(JNIEnv *env, jclass, - jlong metadata_ptr) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetTempSize( + JNIEnv *env, jclass, jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); size_t temp_size; auto status = nvcompDecompressGetTempSize(reinterpret_cast(metadata_ptr), &temp_size); check_nvcomp_status(env, status); return temp_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetOutputSize(JNIEnv *env, jclass, - jlong metadata_ptr) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressGetOutputSize( + JNIEnv *env, jclass, jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); size_t out_size; auto status = nvcompDecompressGetOutputSize(reinterpret_cast(metadata_ptr), &out_size); check_nvcomp_status(env, status); return out_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressAsync(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jlong temp_ptr, jlong temp_size, - jlong metadata_ptr, - jlong out_ptr, jlong out_size, jlong jstream) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_decompressAsync( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jlong temp_ptr, jlong temp_size, + jlong metadata_ptr, jlong out_ptr, jlong out_size, jlong jstream) { try { cudf::jni::auto_set_device(env); auto stream = reinterpret_cast(jstream); auto status = nvcompDecompressAsync(reinterpret_cast(in_ptr), in_size, reinterpret_cast(temp_ptr), temp_size, reinterpret_cast(metadata_ptr), - reinterpret_cast(out_ptr), out_size, - stream); + reinterpret_cast(out_ptr), out_size, stream); check_nvcomp_status(env, status); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } -JNIEXPORT jboolean JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_isLZ4Data(JNIEnv *env, jclass, jlong in_ptr, jlong in_size) { +JNIEXPORT jboolean JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_isLZ4Data(JNIEnv *env, jclass, + jlong in_ptr, + jlong in_size) { try { cudf::jni::auto_set_device(env); return LZ4IsData(reinterpret_cast(in_ptr), in_size); - } CATCH_STD(env, 0) + } + CATCH_STD(env, 0) } -JNIEXPORT jboolean JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_isLZ4Metadata(JNIEnv *env, jclass, jlong metadata_ptr) { +JNIEXPORT jboolean JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_isLZ4Metadata(JNIEnv *env, jclass, + jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); return LZ4IsMetadata(reinterpret_cast(metadata_ptr)); - } CATCH_STD(env, 0) + } + CATCH_STD(env, 0) } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressGetTempSize(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jlong chunk_size) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressGetTempSize( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jlong chunk_size) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); nvcompLZ4FormatOpts opts{}; opts.chunk_size = chunk_size; size_t temp_size; - auto status = nvcompLZ4CompressGetTempSize(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, &temp_size); + auto status = nvcompLZ4CompressGetTempSize(reinterpret_cast(in_ptr), in_size, comp_type, + &opts, &temp_size); check_nvcomp_status(env, status); return temp_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressGetOutputSize(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jlong chunk_size, - jlong temp_ptr, jlong temp_size, - jboolean compute_exact) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressGetOutputSize( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jlong chunk_size, + jlong temp_ptr, jlong temp_size, jboolean compute_exact) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); nvcompLZ4FormatOpts opts{}; opts.chunk_size = chunk_size; size_t out_size; - auto status = nvcompLZ4CompressGetOutputSize(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - &out_size, compute_exact); + auto status = nvcompLZ4CompressGetOutputSize( + reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, &out_size, compute_exact); check_nvcomp_status(env, status); return out_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4Compress(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jlong chunk_size, - jlong temp_ptr, jlong temp_size, - jlong out_ptr, jlong out_size, - jlong jstream) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4Compress( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jlong chunk_size, + jlong temp_ptr, jlong temp_size, jlong out_ptr, jlong out_size, jlong jstream) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -184,27 +174,23 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4Compress(JNIEnv *env, jclass, opts.chunk_size = chunk_size; auto stream = reinterpret_cast(jstream); size_t compressed_size = out_size; - auto status = nvcompLZ4CompressAsync(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - reinterpret_cast(out_ptr), &compressed_size, - stream); + auto status = + nvcompLZ4CompressAsync(reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, + reinterpret_cast(out_ptr), &compressed_size, stream); check_nvcomp_status(env, status); if (cudaStreamSynchronize(stream) != cudaSuccess) { JNI_THROW_NEW(env, NVCOMP_CUDA_ERROR_CLASS, "Error synchronizing stream", 0); } return compressed_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressAsync(JNIEnv *env, jclass, - jlong compressed_output_ptr, - jlong in_ptr, jlong in_size, - jint input_type, jlong chunk_size, - jlong temp_ptr, jlong temp_size, - jlong out_ptr, jlong out_size, - jlong jstream) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressAsync( + JNIEnv *env, jclass, jlong compressed_output_ptr, jlong in_ptr, jlong in_size, jint input_type, + jlong chunk_size, jlong temp_ptr, jlong temp_size, jlong out_ptr, jlong out_size, + jlong jstream) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -213,20 +199,17 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_lz4CompressAsync(JNIEnv *env, jclass, auto stream = reinterpret_cast(jstream); auto compressed_size_ptr = reinterpret_cast(compressed_output_ptr); *compressed_size_ptr = out_size; - auto status = nvcompLZ4CompressAsync(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - reinterpret_cast(out_ptr), compressed_size_ptr, - stream); + auto status = + nvcompLZ4CompressAsync(reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, + reinterpret_cast(out_ptr), compressed_size_ptr, stream); check_nvcomp_status(env, status); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetMetadata(JNIEnv* env, jclass, - jlongArray in_ptrs, - jlongArray in_sizes, - jlong jstream) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetMetadata( + JNIEnv *env, jclass, jlongArray in_ptrs, jlongArray in_sizes, jlong jstream) { try { cudf::jni::auto_set_device(env); @@ -240,65 +223,57 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetMetadata(JNIEnv* env std::back_inserter(sizes), [](jlong x) -> size_t { return static_cast(x); }); - void* metadata_ptr = nullptr; + void *metadata_ptr = nullptr; auto stream = reinterpret_cast(jstream); auto status = nvcompBatchedLZ4DecompressGetMetadata(input_ptrs.data(), sizes.data(), input_ptrs.size(), &metadata_ptr, stream); check_nvcomp_status(env, status); return reinterpret_cast(metadata_ptr); - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressDestroyMetadata(JNIEnv* env, jclass, - jlong metadata_ptr) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressDestroyMetadata( + JNIEnv *env, jclass, jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); - nvcompBatchedLZ4DecompressDestroyMetadata(reinterpret_cast(metadata_ptr)); - } CATCH_STD(env, ); + nvcompBatchedLZ4DecompressDestroyMetadata(reinterpret_cast(metadata_ptr)); + } + CATCH_STD(env, ); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetTempSize(JNIEnv* env, jclass, - jlong metadata_ptr) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetTempSize( + JNIEnv *env, jclass, jlong metadata_ptr) { try { cudf::jni::auto_set_device(env); size_t temp_size; - auto status = nvcompBatchedLZ4DecompressGetTempSize(reinterpret_cast(metadata_ptr), - &temp_size); + auto status = + nvcompBatchedLZ4DecompressGetTempSize(reinterpret_cast(metadata_ptr), &temp_size); check_nvcomp_status(env, status); return static_cast(temp_size); - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlongArray JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetOutputSize(JNIEnv* env, jclass, - jlong metadata_ptr, - jint num_outputs) { +JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressGetOutputSize( + JNIEnv *env, jclass, jlong metadata_ptr, jint num_outputs) { try { cudf::jni::auto_set_device(env); std::vector sizes(num_outputs); - auto status = nvcompBatchedLZ4DecompressGetOutputSize(reinterpret_cast(metadata_ptr), - num_outputs, - sizes.data()); + auto status = nvcompBatchedLZ4DecompressGetOutputSize(reinterpret_cast(metadata_ptr), + num_outputs, sizes.data()); check_nvcomp_status(env, status); cudf::jni::native_jlongArray jsizes(env, num_outputs); std::transform(sizes.begin(), sizes.end(), jsizes.data(), [](size_t x) -> jlong { return static_cast(x); }); return jsizes.get_jArray(); - } CATCH_STD(env, NULL); + } + CATCH_STD(env, NULL); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressAsync(JNIEnv* env, jclass, - jlongArray in_ptrs, - jlongArray in_sizes, - jlong temp_ptr, - jlong temp_size, - jlong metadata_ptr, - jlongArray out_ptrs, - jlongArray out_sizes, - jlong jstream) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressAsync( + JNIEnv *env, jclass, jlongArray in_ptrs, jlongArray in_sizes, jlong temp_ptr, jlong temp_size, + jlong metadata_ptr, jlongArray out_ptrs, jlongArray out_sizes, jlong jstream) { try { cudf::jni::auto_set_device(env); cudf::jni::native_jpointerArray input_ptrs(env, in_ptrs); @@ -325,23 +300,17 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4DecompressAsync(JNIEnv* env, jcla [](jlong x) -> size_t { return static_cast(x); }); auto stream = reinterpret_cast(jstream); - auto status = nvcompBatchedLZ4DecompressAsync(input_ptrs.data(), input_sizes.data(), - input_ptrs.size(), - reinterpret_cast(temp_ptr), - static_cast(temp_size), - reinterpret_cast(metadata_ptr), - output_ptrs.data(), - output_sizes.data(), - stream); + auto status = nvcompBatchedLZ4DecompressAsync( + input_ptrs.data(), input_sizes.data(), input_ptrs.size(), + reinterpret_cast(temp_ptr), static_cast(temp_size), + reinterpret_cast(metadata_ptr), output_ptrs.data(), output_sizes.data(), stream); check_nvcomp_status(env, status); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetTempSize(JNIEnv* env, jclass, - jlongArray in_ptrs, - jlongArray in_sizes, - jlong chunk_size) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetTempSize( + JNIEnv *env, jclass, jlongArray in_ptrs, jlongArray in_sizes, jlong chunk_size) { try { cudf::jni::auto_set_device(env); cudf::jni::native_jpointerArray input_ptrs(env, in_ptrs); @@ -361,16 +330,13 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetTempSize(JNIEnv* env, input_ptrs.size(), &opts, &temp_size); check_nvcomp_status(env, status); return static_cast(temp_size); - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlongArray JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetOutputSize(JNIEnv* env, jclass, - jlongArray in_ptrs, - jlongArray in_sizes, - jlong chunk_size, - jlong temp_ptr, - jlong temp_size) { +JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetOutputSize( + JNIEnv *env, jclass, jlongArray in_ptrs, jlongArray in_sizes, jlong chunk_size, jlong temp_ptr, + jlong temp_size) { try { cudf::jni::auto_set_device(env); cudf::jni::native_jpointerArray input_ptrs(env, in_ptrs); @@ -386,30 +352,22 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressGetOutputSize(JNIEnv* env nvcompLZ4FormatOpts opts{}; opts.chunk_size = chunk_size; std::vector output_sizes(input_ptrs.size()); - auto status = nvcompBatchedLZ4CompressGetOutputSize(input_ptrs.data(), input_sizes.data(), - input_ptrs.size(), &opts, - reinterpret_cast(temp_ptr), - static_cast(temp_size), - output_sizes.data()); + auto status = nvcompBatchedLZ4CompressGetOutputSize( + input_ptrs.data(), input_sizes.data(), input_ptrs.size(), &opts, + reinterpret_cast(temp_ptr), static_cast(temp_size), output_sizes.data()); check_nvcomp_status(env, status); cudf::jni::native_jlongArray jsizes(env, input_ptrs.size()); std::transform(output_sizes.begin(), output_sizes.end(), jsizes.data(), [](size_t x) -> jlong { return static_cast(x); }); return jsizes.get_jArray(); - } CATCH_STD(env, NULL); + } + CATCH_STD(env, NULL); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressAsync(JNIEnv* env, jclass, - jlong compressed_sizes_out_ptr, - jlongArray in_ptrs, - jlongArray in_sizes, - jlong chunk_size, - jlong temp_ptr, - jlong temp_size, - jlongArray out_ptrs, - jlongArray out_sizes, - jlong jstream) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressAsync( + JNIEnv *env, jclass, jlong compressed_sizes_out_ptr, jlongArray in_ptrs, jlongArray in_sizes, + jlong chunk_size, jlong temp_ptr, jlong temp_size, jlongArray out_ptrs, jlongArray out_sizes, + jlong jstream) { try { cudf::jni::auto_set_device(env); cudf::jni::native_jpointerArray input_ptrs(env, in_ptrs); @@ -431,30 +389,26 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_batchedLZ4CompressAsync(JNIEnv* env, jclass cudf::jni::throw_java_exception(env, NVCOMP_ERROR_CLASS, "input/output array size mismatch"); } - auto output_sizes = reinterpret_cast(compressed_sizes_out_ptr); - std::transform(output_jsizes.data(), output_jsizes.data() + output_jsizes.size(), - output_sizes, + auto output_sizes = reinterpret_cast(compressed_sizes_out_ptr); + std::transform(output_jsizes.data(), output_jsizes.data() + output_jsizes.size(), output_sizes, [](jlong x) -> size_t { return static_cast(x); }); nvcompLZ4FormatOpts opts{}; opts.chunk_size = chunk_size; auto stream = reinterpret_cast(jstream); - auto status = nvcompBatchedLZ4CompressAsync(input_ptrs.data(), input_sizes.data(), - input_ptrs.size(), &opts, - reinterpret_cast(temp_ptr), - static_cast(temp_size), - output_ptrs.data(), - output_sizes, // input/output parameter - stream); + auto status = nvcompBatchedLZ4CompressAsync( + input_ptrs.data(), input_sizes.data(), input_ptrs.size(), &opts, + reinterpret_cast(temp_ptr), static_cast(temp_size), output_ptrs.data(), + output_sizes, // input/output parameter + stream); check_nvcomp_status(env, status); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetTempSize(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jint num_rles, - jint num_deltas, jboolean use_bp) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetTempSize( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jint num_rles, + jint num_deltas, jboolean use_bp) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -467,16 +421,13 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetTempSize(JNIEnv *env, jc comp_type, &opts, &temp_size); check_nvcomp_status(env, status); return temp_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetOutputSize(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jint num_rles, - jint num_deltas, jboolean use_bp, - jlong temp_ptr, jlong temp_size, - jboolean compute_exact) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetOutputSize( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jint num_rles, + jint num_deltas, jboolean use_bp, jlong temp_ptr, jlong temp_size, jboolean compute_exact) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -485,23 +436,19 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressGetOutputSize(JNIEnv *env, opts.num_deltas = num_deltas; opts.use_bp = use_bp; size_t out_size; - auto status = nvcompCascadedCompressGetOutputSize(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - &out_size, compute_exact); + auto status = nvcompCascadedCompressGetOutputSize( + reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, &out_size, compute_exact); check_nvcomp_status(env, status); return out_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompress(JNIEnv *env, jclass, - jlong in_ptr, jlong in_size, - jint input_type, jint num_rles, - jint num_deltas, jboolean use_bp, - jlong temp_ptr, jlong temp_size, - jlong out_ptr, jlong out_size, - jlong jstream) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompress( + JNIEnv *env, jclass, jlong in_ptr, jlong in_size, jint input_type, jint num_rles, + jint num_deltas, jboolean use_bp, jlong temp_ptr, jlong temp_size, jlong out_ptr, + jlong out_size, jlong jstream) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -511,28 +458,23 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompress(JNIEnv *env, jclass, opts.use_bp = use_bp; auto stream = reinterpret_cast(jstream); size_t compressed_size = out_size; - auto status = nvcompCascadedCompressAsync(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - reinterpret_cast(out_ptr), &compressed_size, - stream); + auto status = + nvcompCascadedCompressAsync(reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, + reinterpret_cast(out_ptr), &compressed_size, stream); check_nvcomp_status(env, status); if (cudaStreamSynchronize(stream) != cudaSuccess) { JNI_THROW_NEW(env, NVCOMP_CUDA_ERROR_CLASS, "Error synchronizing stream", 0); } return compressed_size; - } CATCH_STD(env, 0); + } + CATCH_STD(env, 0); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressAsync(JNIEnv *env, jclass, - jlong compressed_output_ptr, - jlong in_ptr, jlong in_size, - jint input_type, jint num_rles, - jint num_deltas, jboolean use_bp, - jlong temp_ptr, jlong temp_size, - jlong out_ptr, jlong out_size, - jlong jstream) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressAsync( + JNIEnv *env, jclass, jlong compressed_output_ptr, jlong in_ptr, jlong in_size, jint input_type, + jint num_rles, jint num_deltas, jboolean use_bp, jlong temp_ptr, jlong temp_size, jlong out_ptr, + jlong out_size, jlong jstream) { try { cudf::jni::auto_set_device(env); auto comp_type = static_cast(input_type); @@ -543,13 +485,13 @@ Java_ai_rapids_cudf_nvcomp_NvcompJni_cascadedCompressAsync(JNIEnv *env, jclass, auto stream = reinterpret_cast(jstream); auto compressed_size_ptr = reinterpret_cast(compressed_output_ptr); *compressed_size_ptr = out_size; - auto status = nvcompCascadedCompressAsync(reinterpret_cast(in_ptr), in_size, - comp_type, &opts, - reinterpret_cast(temp_ptr), temp_size, - reinterpret_cast(out_ptr), - compressed_size_ptr, stream); + auto status = + nvcompCascadedCompressAsync(reinterpret_cast(in_ptr), in_size, comp_type, &opts, + reinterpret_cast(temp_ptr), temp_size, + reinterpret_cast(out_ptr), compressed_size_ptr, stream); check_nvcomp_status(env, status); - } CATCH_STD(env, ); + } + CATCH_STD(env, ); } } // extern "C" diff --git a/java/src/main/native/src/NvtxRangeJni.cpp b/java/src/main/native/src/NvtxRangeJni.cpp index ea7a148fb4d..3e50327be8b 100644 --- a/java/src/main/native/src/NvtxRangeJni.cpp +++ b/java/src/main/native/src/NvtxRangeJni.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,15 @@ namespace { struct java_domain { - static constexpr char const* name{"Java"}; + static constexpr char const *name{"Java"}; }; } // anonymous namespace extern "C" { -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_NvtxRange_push(JNIEnv *env, jclass clazz, - jstring name, jint color_bits) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_NvtxRange_push(JNIEnv *env, jclass clazz, jstring name, + jint color_bits) { try { cudf::jni::native_jstring range_name(env, name); nvtx3::color range_color(static_cast(color_bits)); @@ -40,8 +39,7 @@ Java_ai_rapids_cudf_NvtxRange_push(JNIEnv *env, jclass clazz, CATCH_STD(env, ); } -JNIEXPORT void JNICALL -Java_ai_rapids_cudf_NvtxRange_pop(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_NvtxRange_pop(JNIEnv *env, jclass clazz) { try { nvtxDomainRangePop(nvtx3::domain::get()); } diff --git a/java/src/main/native/src/RmmJni.cpp b/java/src/main/native/src/RmmJni.cpp index e604fc7dd46..0105f8c43ca 100644 --- a/java/src/main/native/src/RmmJni.cpp +++ b/java/src/main/native/src/RmmJni.cpp @@ -330,12 +330,9 @@ std::shared_ptr Initialized_resource{}; extern "C" { -JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_initializeInternal(JNIEnv *env, jclass clazz, - jint allocation_mode, jint log_to, - jstring jpath, jlong pool_size, - jlong max_pool_size, - jlong allocation_alignment, - jlong alignment_threshold) { +JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_initializeInternal( + JNIEnv *env, jclass clazz, jint allocation_mode, jint log_to, jstring jpath, jlong pool_size, + jlong max_pool_size, jlong allocation_alignment, jlong alignment_threshold) { try { // make sure the CUDA device is setup in the context cudaError_t cuda_status = cudaFree(0); diff --git a/java/src/main/native/src/ScalarJni.cpp b/java/src/main/native/src/ScalarJni.cpp index f58290395e3..50e6a66ce4f 100644 --- a/java/src/main/native/src/ScalarJni.cpp +++ b/java/src/main/native/src/ScalarJni.cpp @@ -139,13 +139,13 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Scalar_getListAsColumnView(JNIEnv *e CATCH_STD(env, 0); } -JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Scalar_getChildrenFromStructScalar(JNIEnv *env, jclass, - jlong scalar_handle) { +JNIEXPORT jlongArray JNICALL +Java_ai_rapids_cudf_Scalar_getChildrenFromStructScalar(JNIEnv *env, jclass, jlong scalar_handle) { JNI_NULL_CHECK(env, scalar_handle, "scalar handle is null", 0); try { cudf::jni::auto_set_device(env); - const auto s = reinterpret_cast(scalar_handle); - const cudf::table_view& table = s->view(); + const auto s = reinterpret_cast(scalar_handle); + const cudf::table_view &table = s->view(); cudf::jni::native_jpointerArray column_handles(env, table.num_columns()); for (int i = 0; i < table.num_columns(); i++) { column_handles[i] = new cudf::column_view(table.column(i)); @@ -502,12 +502,10 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Scalar_makeStructScalar(JNIEnv *env, cudf::jni::native_jpointerArray column_pointers(env, handles); std::vector columns; columns.reserve(column_pointers.size()); - std::transform(column_pointers.data(), - column_pointers.data() + column_pointers.size(), - std::back_inserter(columns), - [](auto const& col_ptr) { return *col_ptr; }); + std::transform(column_pointers.data(), column_pointers.data() + column_pointers.size(), + std::back_inserter(columns), [](auto const &col_ptr) { return *col_ptr; }); auto s = std::make_unique( - cudf::host_span{columns}, is_valid); + cudf::host_span{columns}, is_valid); return reinterpret_cast(s.release()); } CATCH_STD(env, 0); diff --git a/java/src/main/native/src/TableJni.cpp b/java/src/main/native/src/TableJni.cpp index 790403d7594..78e1bf88a1c 100644 --- a/java/src/main/native/src/TableJni.cpp +++ b/java/src/main/native/src/TableJni.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include #include #include @@ -44,8 +46,6 @@ #include "jni_utils.hpp" #include "row_conversion.hpp" -#include - namespace cudf { namespace jni { @@ -255,7 +255,7 @@ class native_arrow_ipc_writer_handle final { initialized = false; } - std::vector get_column_metadata(const cudf::table_view& tview) { + std::vector get_column_metadata(const cudf::table_view &tview) { if (!column_names.empty() && columns_meta.empty()) { // Rebuild the structure of column meta according to table schema. // All the tables written by this writer should share the same schema, @@ -276,7 +276,7 @@ class native_arrow_ipc_writer_handle final { } private: - cudf::column_metadata build_one_column_meta(const cudf::column_view& cview, size_t& idx, + cudf::column_metadata build_one_column_meta(const cudf::column_view &cview, size_t &idx, const bool consume_name = true) { auto col_meta = cudf::column_metadata{}; if (consume_name) { @@ -301,7 +301,7 @@ class native_arrow_ipc_writer_handle final { return col_meta; } - std::string& get_column_name(const size_t idx) { + std::string &get_column_name(const size_t idx) { if (idx < 0 || idx >= column_names.size()) { throw cudf::jni::jni_exception("Missing names for columns or nested struct columns"); } @@ -614,9 +614,8 @@ jlongArray convert_table_for_return(JNIEnv *env, std::unique_ptr &t return convert_table_for_return(env, table_result, extra); } -jlongArray convert_table_for_return(JNIEnv *env, - std::unique_ptr &first_table, - std::unique_ptr &second_table) { +jlongArray convert_table_for_return(JNIEnv *env, std::unique_ptr &first_table, + std::unique_ptr &second_table) { std::vector> second_tmp = second_table->release(); return convert_table_for_return(env, first_table, second_tmp); } @@ -635,9 +634,9 @@ std::vector resolve_column_order(JNIEnv *env, jbooleanArray jkeys_s std::vector column_order(keys_sort_num); if (keys_sort_num > 0) { std::transform(keys_sort_desc.data(), keys_sort_desc.data() + keys_sort_num, - column_order.begin(), - [](jboolean is_desc) { return is_desc ? cudf::order::DESCENDING - : cudf::order::ASCENDING; }); + column_order.begin(), [](jboolean is_desc) { + return is_desc ? cudf::order::DESCENDING : cudf::order::ASCENDING; + }); } return column_order; } @@ -656,9 +655,9 @@ std::vector resolve_null_precedence(JNIEnv *env, jbooleanArray std::vector null_precedence(null_order_num); if (null_order_num > 0) { std::transform(keys_null_first.data(), keys_null_first.data() + null_order_num, - null_precedence.begin(), - [](jboolean null_before) { return null_before ? cudf::null_order::BEFORE - : cudf::null_order::AFTER; }); + null_precedence.begin(), [](jboolean null_before) { + return null_before ? cudf::null_order::BEFORE : cudf::null_order::AFTER; + }); } return null_precedence; } @@ -666,11 +665,11 @@ std::vector resolve_null_precedence(JNIEnv *env, jbooleanArray namespace { int set_column_metadata(cudf::io::column_in_metadata &column_metadata, - std::vector &col_names, - cudf::jni::native_jbooleanArray &nullability, - cudf::jni::native_jbooleanArray &isInt96, - cudf::jni::native_jintArray &precisions, - cudf::jni::native_jintArray &children, int num_children, int read_index) { + std::vector &col_names, + cudf::jni::native_jbooleanArray &nullability, + cudf::jni::native_jbooleanArray &isInt96, + cudf::jni::native_jintArray &precisions, + cudf::jni::native_jintArray &children, int num_children, int read_index) { int write_index = 0; for (int i = 0; i < num_children; i++, write_index++) { cudf::io::column_in_metadata child; @@ -688,11 +687,11 @@ int set_column_metadata(cudf::io::column_in_metadata &column_metadata, return read_index; } -void createTableMetaData(JNIEnv *env, jint num_children, jobjectArray &j_col_names, jintArray &j_children, - jbooleanArray &j_col_nullability, jobjectArray &j_metadata_keys, - jobjectArray &j_metadata_values, jint j_compression, jint j_stats_freq, - jbooleanArray &j_isInt96, jintArray &j_precisions, - cudf::io::table_input_metadata& metadata) { +void createTableMetaData(JNIEnv *env, jint num_children, jobjectArray &j_col_names, + jintArray &j_children, jbooleanArray &j_col_nullability, + jobjectArray &j_metadata_keys, jobjectArray &j_metadata_values, + jint j_compression, jint j_stats_freq, jbooleanArray &j_isInt96, + jintArray &j_precisions, cudf::io::table_input_metadata &metadata) { cudf::jni::auto_set_device(env); cudf::jni::native_jstringArray col_names(env, j_col_names); cudf::jni::native_jbooleanArray col_nullability(env, j_col_nullability); @@ -716,14 +715,14 @@ void createTableMetaData(JNIEnv *env, jint num_children, jobjectArray &j_col_nam .set_decimal_precision(precisions[read_index]); int childs_children = children[read_index++]; if (childs_children > 0) { - read_index = set_column_metadata(metadata.column_metadata[write_index], cpp_names, - col_nullability, isInt96, precisions, children, childs_children, read_index); + read_index = + set_column_metadata(metadata.column_metadata[write_index], cpp_names, col_nullability, + isInt96, precisions, children, childs_children, read_index); } } for (auto i = 0; i < meta_keys.size(); ++i) { metadata.user_data[meta_keys[i].get()] = meta_values[i].get(); } - } // Check that window parameters are valid. @@ -862,8 +861,7 @@ jlongArray combine_join_results(JNIEnv *env, cudf::table &left_results, extern "C" { -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_createCudfTableView(JNIEnv *env, - jclass, +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_createCudfTableView(JNIEnv *env, jclass, jlongArray j_cudf_columns) { JNI_NULL_CHECK(env, j_cudf_columns, "columns are null", 0); @@ -944,13 +942,13 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_sortOrder(JNIEnv *env, jclass, jsize num_columns_is_desc = n_is_descending.size(); JNI_ARG_CHECK(env, num_columns_is_desc == num_columns, - "columns and is_descending lengths don't match", 0); + "columns and is_descending lengths don't match", 0); const cudf::jni::native_jbooleanArray n_are_nulls_smallest(env, j_are_nulls_smallest); jsize num_columns_null_smallest = n_are_nulls_smallest.size(); JNI_ARG_CHECK(env, num_columns_null_smallest == num_columns, - "columns and is_descending lengths don't match", 0); + "columns and is_descending lengths don't match", 0); std::vector order(n_is_descending.size()); for (int i = 0; i < n_is_descending.size(); i++) { @@ -973,7 +971,6 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_sortOrder(JNIEnv *env, jclass, CATCH_STD(env, 0); } - JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_orderBy(JNIEnv *env, jclass, jlong j_input_table, jlongArray j_sort_keys_columns, @@ -995,13 +992,13 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_orderBy(JNIEnv *env, jcla jsize num_columns_is_desc = n_is_descending.size(); JNI_ARG_CHECK(env, num_columns_is_desc == num_columns, - "columns and is_descending lengths don't match", 0); + "columns and is_descending lengths don't match", 0); const cudf::jni::native_jbooleanArray n_are_nulls_smallest(env, j_are_nulls_smallest); jsize num_columns_null_smallest = n_are_nulls_smallest.size(); JNI_ARG_CHECK(env, num_columns_null_smallest == num_columns, - "columns and areNullsSmallest lengths don't match", 0); + "columns and areNullsSmallest lengths don't match", 0); std::vector order(n_is_descending.size()); for (int i = 0; i < n_is_descending.size(); i++) { @@ -1049,13 +1046,13 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_merge(JNIEnv *env, jclass jsize num_columns_is_desc = n_is_descending.size(); JNI_ARG_CHECK(env, num_columns_is_desc == num_columns, - "columns and is_descending lengths don't match", NULL); + "columns and is_descending lengths don't match", NULL); const cudf::jni::native_jbooleanArray n_are_nulls_smallest(env, j_are_nulls_smallest); jsize num_columns_null_smallest = n_are_nulls_smallest.size(); JNI_ARG_CHECK(env, num_columns_null_smallest == num_columns, - "columns and areNullsSmallest lengths don't match", NULL); + "columns and areNullsSmallest lengths don't match", NULL); std::vector indexes(n_sort_key_indexes.size()); for (int i = 0; i < n_sort_key_indexes.size(); i++) { @@ -1146,8 +1143,8 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_readCSV( } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_readParquet( - JNIEnv *env, jclass, jobjectArray filter_col_names, jstring inputfilepath, - jlong buffer, jlong buffer_length, jint unit, jboolean strict_decimal_types) { + JNIEnv *env, jclass, jobjectArray filter_col_names, jstring inputfilepath, jlong buffer, + jlong buffer_length, jint unit, jboolean strict_decimal_types) { bool read_buffer = true; if (buffer == 0) { JNI_NULL_CHECK(env, inputfilepath, "input file or buffer must be supplied", NULL); @@ -1203,14 +1200,14 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetBufferBegin( try { std::unique_ptr data_sink( new cudf::jni::jni_writer_data_sink(env, consumer)); - + using namespace cudf::io; using namespace cudf::jni; sink_info sink{data_sink.get()}; table_input_metadata metadata; - createTableMetaData(env, j_num_children, j_col_names, j_children, j_col_nullability, j_metadata_keys, - j_metadata_values, j_compression, j_stats_freq, j_isInt96, j_precisions, - metadata); + createTableMetaData(env, j_num_children, j_col_names, j_children, j_col_nullability, + j_metadata_keys, j_metadata_values, j_compression, j_stats_freq, j_isInt96, + j_precisions, metadata); chunked_parquet_writer_options opts = chunked_parquet_writer_options::builder(sink) @@ -1239,11 +1236,12 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetFileBegin( try { cudf::jni::native_jstring output_path(env, j_output_path); - using namespace cudf::io; - using namespace cudf::jni; + using namespace cudf::io; + using namespace cudf::jni; table_input_metadata metadata; - createTableMetaData(env, j_num_children, j_col_names, j_children, j_col_nullability, j_metadata_keys, - j_metadata_values, j_compression, j_stats_freq, j_isInt96, j_precisions, metadata); + createTableMetaData(env, j_num_children, j_col_names, j_children, j_col_nullability, + j_metadata_keys, j_metadata_values, j_compression, j_stats_freq, j_isInt96, + j_precisions, metadata); sink_info sink{output_path.get()}; chunked_parquet_writer_options opts = chunked_parquet_writer_options::builder(sink) @@ -1298,8 +1296,8 @@ JNIEXPORT void JNICALL Java_ai_rapids_cudf_Table_writeParquetEnd(JNIEnv *env, jc } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_readORC( - JNIEnv *env, jclass, jobjectArray filter_col_names, jstring inputfilepath, - jlong buffer, jlong buffer_length, jboolean usingNumPyTypes, jint unit) { + JNIEnv *env, jclass, jobjectArray filter_col_names, jstring inputfilepath, jlong buffer, + jlong buffer_length, jboolean usingNumPyTypes, jint unit) { bool read_buffer = true; if (buffer == 0) { JNI_NULL_CHECK(env, inputfilepath, "input file or buffer must be supplied", NULL); @@ -1807,10 +1805,10 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_leftSemiJoin( std::vector right_join_cols( right_join_cols_arr.data(), right_join_cols_arr.data() + right_join_cols_arr.size()); - std::unique_ptr result = cudf::left_semi_join( - *n_left_table, *n_right_table, left_join_cols, right_join_cols, - static_cast(compare_nulls_equal) ? cudf::null_equality::EQUAL : - cudf::null_equality::UNEQUAL); + std::unique_ptr result = + cudf::left_semi_join(*n_left_table, *n_right_table, left_join_cols, right_join_cols, + static_cast(compare_nulls_equal) ? cudf::null_equality::EQUAL : + cudf::null_equality::UNEQUAL); return cudf::jni::convert_table_for_return(env, result); } @@ -1836,10 +1834,10 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_leftAntiJoin( std::vector right_join_cols( right_join_cols_arr.data(), right_join_cols_arr.data() + right_join_cols_arr.size()); - std::unique_ptr result = cudf::left_anti_join( - *n_left_table, *n_right_table, left_join_cols, right_join_cols, - static_cast(compare_nulls_equal) ? cudf::null_equality::EQUAL : - cudf::null_equality::UNEQUAL); + std::unique_ptr result = + cudf::left_anti_join(*n_left_table, *n_right_table, left_join_cols, right_join_cols, + static_cast(compare_nulls_equal) ? cudf::null_equality::EQUAL : + cudf::null_equality::UNEQUAL); return cudf::jni::convert_table_for_return(env, result); } @@ -1912,7 +1910,8 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_crossJoin(JNIEnv *env, jc JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_interleaveColumns(JNIEnv *env, jclass, jlongArray j_cudf_table_view) { - JNI_NULL_CHECK(env, j_cudf_table_view, "table is null", 0); try { + JNI_NULL_CHECK(env, j_cudf_table_view, "table is null", 0); + try { cudf::jni::auto_set_device(env); cudf::table_view *table_view = reinterpret_cast(j_cudf_table_view); std::unique_ptr result = cudf::interleave_columns(*table_view); @@ -1960,9 +1959,7 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_partition(JNIEnv *env, jc cudf::column_view *n_part_column = reinterpret_cast(partition_column); cudf::jni::native_jintArray n_output_offsets(env, output_offsets); - auto result = cudf::partition(*n_input_table, - *n_part_column, - number_of_partitions); + auto result = cudf::partition(*n_input_table, *n_part_column, number_of_partitions); for (size_t i = 0; i < result.second.size() - 1; i++) { // for what ever reason partition returns the length of the result at then @@ -1976,12 +1973,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_partition(JNIEnv *env, jc CATCH_STD(env, NULL); } -JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_hashPartition(JNIEnv *env, jclass, - jlong input_table, - jintArray columns_to_hash, - jint hash_function, - jint number_of_partitions, - jintArray output_offsets) { +JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_hashPartition( + JNIEnv *env, jclass, jlong input_table, jintArray columns_to_hash, jint hash_function, + jint number_of_partitions, jintArray output_offsets) { JNI_NULL_CHECK(env, input_table, "input table is null", NULL); JNI_NULL_CHECK(env, columns_to_hash, "columns_to_hash is null", NULL); @@ -2003,10 +1997,7 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_hashPartition(JNIEnv *env } std::pair, std::vector> result = - cudf::hash_partition(*n_input_table, - columns_to_hash_vec, - number_of_partitions, - hash_func); + cudf::hash_partition(*n_input_table, columns_to_hash_vec, number_of_partitions, hash_func); for (size_t i = 0; i < result.second.size(); i++) { n_output_offsets[i] = result.second[i]; @@ -2042,9 +2033,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_roundRobinPartition( } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByAggregate( - JNIEnv *env, jclass, jlong input_table, jintArray keys, - jintArray aggregate_column_indices, jlongArray agg_instances, jboolean ignore_null_keys, - jboolean jkey_sorted, jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { + JNIEnv *env, jclass, jlong input_table, jintArray keys, jintArray aggregate_column_indices, + jlongArray agg_instances, jboolean ignore_null_keys, jboolean jkey_sorted, + jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { JNI_NULL_CHECK(env, input_table, "input table is null", NULL); JNI_NULL_CHECK(env, keys, "input keys are null", NULL); JNI_NULL_CHECK(env, aggregate_column_indices, "input aggregate_column_indices are null", NULL); @@ -2063,16 +2054,11 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByAggregate( } cudf::table_view n_keys_table(n_keys_cols); - auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, - n_keys.size()); - auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, - n_keys.size()); - cudf::groupby::groupby grouper(n_keys_table, - ignore_null_keys ? cudf::null_policy::EXCLUDE - : cudf::null_policy::INCLUDE, - jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, - column_order, - null_precedence); + auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, n_keys.size()); + auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, n_keys.size()); + cudf::groupby::groupby grouper( + n_keys_table, ignore_null_keys ? cudf::null_policy::EXCLUDE : cudf::null_policy::INCLUDE, + jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, column_order, null_precedence); // Aggregates are passed in already grouped by column, so we just need to fill it in // as we go. @@ -2109,9 +2095,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByAggregate( } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByScan( - JNIEnv *env, jclass, jlong input_table, jintArray keys, - jintArray aggregate_column_indices, jlongArray agg_instances, jboolean ignore_null_keys, - jboolean jkey_sorted, jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { + JNIEnv *env, jclass, jlong input_table, jintArray keys, jintArray aggregate_column_indices, + jlongArray agg_instances, jboolean ignore_null_keys, jboolean jkey_sorted, + jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { JNI_NULL_CHECK(env, input_table, "input table is null", NULL); JNI_NULL_CHECK(env, keys, "input keys are null", NULL); JNI_NULL_CHECK(env, aggregate_column_indices, "input aggregate_column_indices are null", NULL); @@ -2130,16 +2116,11 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByScan( } cudf::table_view n_keys_table(n_keys_cols); - auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, - n_keys.size()); - auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, - n_keys.size()); - cudf::groupby::groupby grouper(n_keys_table, - ignore_null_keys ? cudf::null_policy::EXCLUDE - : cudf::null_policy::INCLUDE, - jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, - column_order, - null_precedence); + auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, n_keys.size()); + auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, n_keys.size()); + cudf::groupby::groupby grouper( + n_keys_table, ignore_null_keys ? cudf::null_policy::EXCLUDE : cudf::null_policy::INCLUDE, + jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, column_order, null_precedence); // Aggregates are passed in already grouped by column, so we just need to fill it in // as we go. @@ -2176,9 +2157,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByScan( } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByReplaceNulls( - JNIEnv *env, jclass, jlong input_table, jintArray keys, - jintArray replace_column_indices, jbooleanArray is_preceding, jboolean ignore_null_keys, - jboolean jkey_sorted, jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { + JNIEnv *env, jclass, jlong input_table, jintArray keys, jintArray replace_column_indices, + jbooleanArray is_preceding, jboolean ignore_null_keys, jboolean jkey_sorted, + jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { JNI_NULL_CHECK(env, input_table, "input table is null", NULL); JNI_NULL_CHECK(env, keys, "input keys are null", NULL); JNI_NULL_CHECK(env, replace_column_indices, "input replace_column_indices are null", NULL); @@ -2197,30 +2178,26 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_groupByReplaceNulls( } cudf::table_view n_keys_table(n_keys_cols); - auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, - n_keys.size()); - auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, - n_keys.size()); - cudf::groupby::groupby grouper(n_keys_table, - ignore_null_keys ? cudf::null_policy::EXCLUDE - : cudf::null_policy::INCLUDE, - jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, - column_order, - null_precedence); + auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, n_keys.size()); + auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, n_keys.size()); + cudf::groupby::groupby grouper( + n_keys_table, ignore_null_keys ? cudf::null_policy::EXCLUDE : cudf::null_policy::INCLUDE, + jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO, column_order, null_precedence); // Aggregates are passed in already grouped by column, so we just need to fill it in // as we go. std::vector n_replace_cols; n_replace_cols.reserve(n_values.size()); - for (int i = 0; i < n_values.size(); i++) { + for (int i = 0; i < n_values.size(); i++) { n_replace_cols.push_back(n_input_table->column(n_values[i])); } cudf::table_view n_replace_table(n_replace_cols); std::vector policies; policies.reserve(n_is_preceding.size()); - for (int i = 0; i < n_is_preceding.size(); i++) { - policies.push_back(n_is_preceding[i] ? cudf::replace_policy::PRECEDING : cudf::replace_policy::FOLLOWING); + for (int i = 0; i < n_is_preceding.size(); i++) { + policies.push_back(n_is_preceding[i] ? cudf::replace_policy::PRECEDING : + cudf::replace_policy::FOLLOWING); } std::pair, std::unique_ptr> result = @@ -2388,8 +2365,8 @@ JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplit(JNIEnv cudf::jni::native_jobjectArray n_result = cudf::jni::contiguous_table_array(env, result.size()); for (size_t i = 0; i < result.size(); i++) { - n_result.set(i, cudf::jni::contiguous_table_from(env, result[i].data, - result[i].table.num_rows())); + n_result.set( + i, cudf::jni::contiguous_table_from(env, result[i].data, result[i].table.num_rows())); } return n_result.wrapped(); } @@ -2434,8 +2411,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rollingWindowAggregate( std::vector> result_columns; for (int i(0); i < values.size(); ++i) { - cudf::rolling_aggregation * agg = dynamic_cast(agg_instances[i]); - JNI_ARG_CHECK(env, agg != nullptr, "aggregation is not an instance of rolling_aggregation", nullptr); + cudf::rolling_aggregation *agg = dynamic_cast(agg_instances[i]); + JNI_ARG_CHECK(env, agg != nullptr, "aggregation is not an instance of rolling_aggregation", + nullptr); int agg_column_index = values[i]; if (default_output[i] != nullptr) { @@ -2443,9 +2421,9 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rollingWindowAggregate( groupby_keys, input_table->column(agg_column_index), *default_output[i], preceding[i], following[i], min_periods[i], *agg))); } else { - result_columns.emplace_back(std::move(cudf::grouped_rolling_window( - groupby_keys, input_table->column(agg_column_index), preceding[i], following[i], - min_periods[i], *agg))); + result_columns.emplace_back(std::move( + cudf::grouped_rolling_window(groupby_keys, input_table->column(agg_column_index), + preceding[i], following[i], min_periods[i], *agg))); } } @@ -2456,12 +2434,11 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rollingWindowAggregate( } JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rangeRollingWindowAggregate( - JNIEnv *env, jclass, jlong j_input_table, jintArray j_keys, - jintArray j_orderby_column_indices, jbooleanArray j_is_orderby_ascending, - jintArray j_aggregate_column_indices, jlongArray j_agg_instances, jintArray j_min_periods, - jlongArray j_preceding, jlongArray j_following, - jbooleanArray j_unbounded_preceding, jbooleanArray j_unbounded_following, - jboolean ignore_null_keys) { + JNIEnv *env, jclass, jlong j_input_table, jintArray j_keys, jintArray j_orderby_column_indices, + jbooleanArray j_is_orderby_ascending, jintArray j_aggregate_column_indices, + jlongArray j_agg_instances, jintArray j_min_periods, jlongArray j_preceding, + jlongArray j_following, jbooleanArray j_unbounded_preceding, + jbooleanArray j_unbounded_following, jboolean ignore_null_keys) { JNI_NULL_CHECK(env, j_input_table, "input table is null", NULL); JNI_NULL_CHECK(env, j_keys, "input keys are null", NULL); @@ -2513,7 +2490,7 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rangeRollingWindowAggrega unbounded_type = cudf::data_type{cudf::type_id::DURATION_DAYS}; break; case cudf::type_id::TIMESTAMP_SECONDS: - unbounded_type =cudf::data_type{cudf::type_id::DURATION_SECONDS}; + unbounded_type = cudf::data_type{cudf::type_id::DURATION_SECONDS}; break; case cudf::type_id::TIMESTAMP_MILLISECONDS: unbounded_type = cudf::data_type{cudf::type_id::DURATION_MILLISECONDS}; @@ -2524,30 +2501,23 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_rangeRollingWindowAggrega case cudf::type_id::TIMESTAMP_NANOSECONDS: unbounded_type = cudf::data_type{cudf::type_id::DURATION_NANOSECONDS}; break; - default: - break; + default: break; } } - cudf::rolling_aggregation * agg = dynamic_cast(agg_instances[i]); - JNI_ARG_CHECK(env, agg != nullptr, "aggregation is not an instance of rolling_aggregation", nullptr); - - result_columns.emplace_back( - std::move( - cudf::grouped_range_rolling_window( - groupby_keys, - order_by_column, - orderbys_ascending[i] ? cudf::order::ASCENDING : cudf::order::DESCENDING, - input_table->column(agg_column_index), - unbounded_preceding[i] ? cudf::range_window_bounds::unbounded(unbounded_type) : - cudf::range_window_bounds::get(*preceding[i]), - unbounded_following[i] ? cudf::range_window_bounds::unbounded(unbounded_type) : - cudf::range_window_bounds::get(*following[i]), - min_periods[i], - *agg - ) - ) - ); + cudf::rolling_aggregation *agg = dynamic_cast(agg_instances[i]); + JNI_ARG_CHECK(env, agg != nullptr, "aggregation is not an instance of rolling_aggregation", + nullptr); + + result_columns.emplace_back(std::move(cudf::grouped_range_rolling_window( + groupby_keys, order_by_column, + orderbys_ascending[i] ? cudf::order::ASCENDING : cudf::order::DESCENDING, + input_table->column(agg_column_index), + unbounded_preceding[i] ? cudf::range_window_bounds::unbounded(unbounded_type) : + cudf::range_window_bounds::get(*preceding[i]), + unbounded_following[i] ? cudf::range_window_bounds::unbounded(unbounded_type) : + cudf::range_window_bounds::get(*following[i]), + min_periods[i], *agg))); } auto result_table = std::make_unique(std::move(result_columns)); @@ -2612,24 +2582,20 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_Table_explodeOuterPosition(JNIE CATCH_STD(env, 0); } -JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_rowBitCount(JNIEnv* env, jclass, jlong j_table) { +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Table_rowBitCount(JNIEnv *env, jclass, jlong j_table) { JNI_NULL_CHECK(env, j_table, "table is null", 0); try { cudf::jni::auto_set_device(env); - auto t = reinterpret_cast(j_table); + auto t = reinterpret_cast(j_table); std::unique_ptr result = cudf::row_bit_count(*t); return reinterpret_cast(result.release()); } CATCH_STD(env, 0); } -JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups(JNIEnv *env, jclass, - jlong jinput_table, - jintArray jkey_indices, - jboolean jignore_null_keys, - jboolean jkey_sorted, - jbooleanArray jkeys_sort_desc, - jbooleanArray jkeys_null_first) { +JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups( + JNIEnv *env, jclass, jlong jinput_table, jintArray jkey_indices, jboolean jignore_null_keys, + jboolean jkey_sorted, jbooleanArray jkeys_sort_desc, jbooleanArray jkeys_null_first) { JNI_NULL_CHECK(env, jinput_table, "table native handle is null", 0); JNI_NULL_CHECK(env, jkey_indices, "key indices are null", 0); // Two main steps to split the groups in the input table. @@ -2647,17 +2613,16 @@ JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups(J std::vector key_indices(n_key_indices.data(), n_key_indices.data() + n_key_indices.size()); auto keys = input_table->select(key_indices); - auto null_handling = jignore_null_keys ? cudf::null_policy::EXCLUDE - : cudf::null_policy::INCLUDE; + auto null_handling = + jignore_null_keys ? cudf::null_policy::EXCLUDE : cudf::null_policy::INCLUDE; auto keys_are_sorted = jkey_sorted ? cudf::sorted::YES : cudf::sorted::NO; - auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, - key_indices.size()); - auto null_precedence = cudf::jni::resolve_null_precedence(env, jkeys_null_first, - key_indices.size()); + auto column_order = cudf::jni::resolve_column_order(env, jkeys_sort_desc, key_indices.size()); + auto null_precedence = + cudf::jni::resolve_null_precedence(env, jkeys_null_first, key_indices.size()); // Constructs a groupby - cudf::groupby::groupby grouper(keys, null_handling, keys_are_sorted, - column_order, null_precedence); + cudf::groupby::groupby grouper(keys, null_handling, keys_are_sorted, column_order, + null_precedence); // 1) Gets the groups(keys, offsets, values) from groupby. // @@ -2674,7 +2639,7 @@ JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups(J // not key column, so adds it as value column. value_indices.emplace_back(index); } - index ++; + index++; } cudf::table_view values_view = input_table->select(value_indices); cudf::groupby::groupby::groups groups = grouper.get_groups(values_view); @@ -2687,31 +2652,32 @@ JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups(J auto key_view_it = key_view.begin(); for (auto key_id : key_indices) { grouped_cols.at(key_id) = std::move(*key_view_it); - key_view_it ++; + key_view_it++; } // value columns auto value_view = groups.values->view(); auto value_view_it = value_view.begin(); for (auto value_id : value_indices) { grouped_cols.at(value_id) = std::move(*value_view_it); - value_view_it ++; + value_view_it++; } cudf::table_view grouped_table(grouped_cols); // When no key columns, uses the input table instead, because the output // of 'get_groups' is empty. - auto& grouped_view = key_indices.empty() ? *input_table : grouped_table; + auto &grouped_view = key_indices.empty() ? *input_table : grouped_table; // Resolves the split indices from offsets vector directly to avoid copying. Since // the offsets vector may be very large if there are too many small groups. - std::vector& split_indices = groups.offsets; + std::vector &split_indices = groups.offsets; // Offsets laysout is [0, split indices..., num_rows] or [0] for empty keys, so // need to removes the first and last elements. split_indices.erase(split_indices.begin()); - if (!split_indices.empty()) { split_indices.pop_back(); } + if (!split_indices.empty()) { + split_indices.pop_back(); + } // 2) Splits the groups. - std::vector result = - cudf::contiguous_split(grouped_view, split_indices); + std::vector result = cudf::contiguous_split(grouped_view, split_indices); // Release the grouped table right away after split done. groups.keys.reset(nullptr); groups.values.reset(nullptr); @@ -2720,8 +2686,8 @@ JNIEXPORT jobjectArray JNICALL Java_ai_rapids_cudf_Table_contiguousSplitGroups(J cudf::jni::native_jobjectArray n_result = cudf::jni::contiguous_table_array(env, result.size()); for (size_t i = 0; i < result.size(); i++) { - n_result.set(i, cudf::jni::contiguous_table_from(env, result[i].data, - result[i].table.num_rows())); + n_result.set( + i, cudf::jni::contiguous_table_from(env, result[i].data, result[i].table.num_rows())); } return n_result.wrapped(); } diff --git a/java/src/main/native/src/cudf_jni_apis.hpp b/java/src/main/native/src/cudf_jni_apis.hpp index 14999156890..fbcca0c82ee 100644 --- a/java/src/main/native/src/cudf_jni_apis.hpp +++ b/java/src/main/native/src/cudf_jni_apis.hpp @@ -75,7 +75,7 @@ void auto_set_device(JNIEnv *env); * The operation has not necessarily completed when this returns, but it could overlap with * operations occurring on other streams. */ -void device_memset_async(JNIEnv *env, rmm::device_buffer& buf, char value); +void device_memset_async(JNIEnv *env, rmm::device_buffer &buf, char value); } // namespace jni } // namespace cudf diff --git a/java/src/main/native/src/dtype_utils.hpp b/java/src/main/native/src/dtype_utils.hpp index bde7bd2894e..9fae0c585e6 100644 --- a/java/src/main/native/src/dtype_utils.hpp +++ b/java/src/main/native/src/dtype_utils.hpp @@ -15,9 +15,10 @@ */ #pragma once -#include #include +#include + namespace cudf { namespace jni { @@ -25,9 +26,7 @@ namespace jni { inline cudf::data_type timestamp_to_duration(cudf::data_type dt) { cudf::type_id duration_type_id; switch (dt.id()) { - case cudf::type_id::TIMESTAMP_DAYS: - duration_type_id = cudf::type_id::DURATION_DAYS; - break; + case cudf::type_id::TIMESTAMP_DAYS: duration_type_id = cudf::type_id::DURATION_DAYS; break; case cudf::type_id::TIMESTAMP_SECONDS: duration_type_id = cudf::type_id::DURATION_SECONDS; break; @@ -40,14 +39,13 @@ inline cudf::data_type timestamp_to_duration(cudf::data_type dt) { case cudf::type_id::TIMESTAMP_NANOSECONDS: duration_type_id = cudf::type_id::DURATION_NANOSECONDS; break; - default: - throw std::logic_error("Unexpected type in timestamp_to_duration"); + default: throw std::logic_error("Unexpected type in timestamp_to_duration"); } return cudf::data_type(duration_type_id); } inline bool is_decimal_type(cudf::type_id n_type) { - return n_type == cudf::type_id::DECIMAL32 || n_type == cudf::type_id::DECIMAL64 ; + return n_type == cudf::type_id::DECIMAL32 || n_type == cudf::type_id::DECIMAL64; } // create data_type including scale for decimal type diff --git a/java/src/main/native/src/map_lookup.hpp b/java/src/main/native/src/map_lookup.hpp index 301293dc188..40c182da59b 100644 --- a/java/src/main/native/src/map_lookup.hpp +++ b/java/src/main/native/src/map_lookup.hpp @@ -51,7 +51,6 @@ map_lookup(column_view const &map_column, string_scalar lookup_key, bool has_nul rmm::cuda_stream_view stream = rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()); - /** * @brief Looks up a "map" column by specified key to see if the key exists or not, * and returns a cudf column of bool value. @@ -80,8 +79,8 @@ map_lookup(column_view const &map_column, string_scalar lookup_key, bool has_nul */ std::unique_ptr map_contains(column_view const &map_column, string_scalar lookup_key, bool has_nulls = true, - rmm::cuda_stream_view stream = rmm::cuda_stream_default, - rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()); + rmm::cuda_stream_view stream = rmm::cuda_stream_default, + rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()); } // namespace jni diff --git a/python/.flake8.cython b/python/.flake8.cython index 243147f397f..92d467db159 100644 --- a/python/.flake8.cython +++ b/python/.flake8.cython @@ -17,9 +17,10 @@ [flake8] filename = *.pyx, *.pxd, *.pxi exclude = *.egg, build, docs, .git -ignore = E999, E225, E226, E227, W503, W504, E211 +ignore = E999, E225, E226, E227, W503, W504, E211, E402 # Rules ignored: +# E402: invalid syntax (works for Python, not Cython) # E999: invalid syntax (works for Python, not Cython) # E211: whitespace before '(' (used in multi-line imports) # E225: Missing whitespace around operators (breaks cython casting syntax like ) diff --git a/python/cudf/cudf/_lib/aggregation.pxd b/python/cudf/cudf/_lib/aggregation.pxd index 56fa9fdc63e..f608dab3fe1 100644 --- a/python/cudf/cudf/_lib/aggregation.pxd +++ b/python/cudf/cudf/_lib/aggregation.pxd @@ -1,8 +1,8 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.aggregation cimport aggregation -from cudf._lib.cpp.aggregation cimport rolling_aggregation + +from cudf._lib.cpp.aggregation cimport aggregation, rolling_aggregation cdef class Aggregation: diff --git a/python/cudf/cudf/_lib/aggregation.pyx b/python/cudf/cudf/_lib/aggregation.pyx index cda35025c7e..4c94452c73d 100644 --- a/python/cudf/cudf/_lib/aggregation.pyx +++ b/python/cudf/cudf/_lib/aggregation.pyx @@ -2,27 +2,30 @@ from enum import Enum -import pandas as pd import numba import numpy as np -from libcpp.string cimport string +import pandas as pd + from libcpp.memory cimport unique_ptr -from libcpp.vector cimport vector +from libcpp.string cimport string from libcpp.utility cimport move +from libcpp.vector cimport vector + +from cudf._lib.types import NullHandling, cudf_to_np_types, np_to_cudf_types from cudf.utils import cudautils -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types, NullHandling from cudf._lib.types cimport ( underlying_type_t_interpolation, underlying_type_t_null_policy, underlying_type_t_type_id, ) -from cudf._lib.types import Interpolation from numba.np import numpy_support -cimport cudf._lib.cpp.types as libcudf_types +from cudf._lib.types import Interpolation + cimport cudf._lib.cpp.aggregation as libcudf_aggregation +cimport cudf._lib.cpp.types as libcudf_types class AggregationKind(Enum): diff --git a/python/cudf/cudf/_lib/avro.pyx b/python/cudf/cudf/_lib/avro.pyx index ed98429a2d6..52ddbd8b8fb 100644 --- a/python/cudf/cudf/_lib/avro.pyx +++ b/python/cudf/cudf/_lib/avro.pyx @@ -1,14 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.io.avro cimport ( - avro_reader_options, - read_avro as libcudf_read_avro -) - from libcpp.string cimport string -from libcpp.vector cimport vector from libcpp.utility cimport move +from libcpp.vector cimport vector +from cudf._lib.cpp.io.avro cimport ( + avro_reader_options, + read_avro as libcudf_read_avro, +) from cudf._lib.cpp.io.types cimport table_with_metadata from cudf._lib.cpp.types cimport size_type from cudf._lib.io.utils cimport make_source_info diff --git a/python/cudf/cudf/_lib/binaryop.pxd b/python/cudf/cudf/_lib/binaryop.pxd index 3fb36055465..1f6022251b3 100644 --- a/python/cudf/cudf/_lib/binaryop.pxd +++ b/python/cudf/cudf/_lib/binaryop.pxd @@ -2,5 +2,4 @@ from libc.stdint cimport int32_t - ctypedef int32_t underlying_type_t_binary_operator diff --git a/python/cudf/cudf/_lib/binaryop.pyx b/python/cudf/cudf/_lib/binaryop.pyx index 5eaec640b15..d8d4fe0b40b 100644 --- a/python/cudf/cudf/_lib/binaryop.pyx +++ b/python/cudf/cudf/_lib/binaryop.pyx @@ -1,32 +1,33 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -import numpy as np from enum import IntEnum +import numpy as np + from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.binaryop cimport underlying_type_t_binary_operator from cudf._lib.column cimport Column + from cudf._lib.replace import replace_nulls from cudf._lib.scalar import as_device_scalar + from cudf._lib.scalar cimport DeviceScalar + from cudf._lib.types import np_to_cudf_types -from cudf._lib.types cimport underlying_type_t_type_id, dtype_to_data_type from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport ( - data_type, - type_id, -) +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.types cimport data_type, type_id +from cudf._lib.types cimport dtype_to_data_type, underlying_type_t_type_id -from cudf.utils.dtypes import is_string_dtype, is_scalar +from cudf.utils.dtypes import is_scalar, is_string_dtype -from cudf._lib.cpp.binaryop cimport binary_operator cimport cudf._lib.cpp.binaryop as cpp_binaryop +from cudf._lib.cpp.binaryop cimport binary_operator class BinaryOperation(IntEnum): diff --git a/python/cudf/cudf/_lib/column.pxd b/python/cudf/cudf/_lib/column.pxd index 6fb834410e6..2df958466c6 100644 --- a/python/cudf/cudf/_lib/column.pxd +++ b/python/cudf/cudf/_lib/column.pxd @@ -5,12 +5,9 @@ from libcpp.memory cimport unique_ptr from rmm._lib.device_buffer cimport device_buffer -from cudf._lib.cpp.types cimport size_type - from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view +from cudf._lib.cpp.types cimport size_type cdef class Column: diff --git a/python/cudf/cudf/_lib/column.pyi b/python/cudf/cudf/_lib/column.pyi index 3387a9f268e..bafa1c914fd 100644 --- a/python/cudf/cudf/_lib/column.pyi +++ b/python/cudf/cudf/_lib/column.pyi @@ -1,13 +1,13 @@ # Copyright (c) 2021, NVIDIA CORPORATION. from __future__ import annotations -from typing import Tuple, Union, TypeVar, Optional -from cudf._typing import DtypeObj, Dtype, ScalarLike +from typing import Optional, Tuple, TypeVar, Union + +from cudf._typing import Dtype, DtypeObj, ScalarLike from cudf.core.buffer import Buffer from cudf.core.column import ColumnBase - T = TypeVar("T") class Column: diff --git a/python/cudf/cudf/_lib/column.pyx b/python/cudf/cudf/_lib/column.pyx index a3e01a4ac9d..b5223a32a18 100644 --- a/python/cudf/cudf/_lib/column.pyx +++ b/python/cudf/cudf/_lib/column.pyx @@ -3,51 +3,54 @@ import cupy as cp import numpy as np import pandas as pd + import rmm import cudf - +import cudf._lib as libcudfxx from cudf.core.buffer import Buffer from cudf.utils.dtypes import ( is_categorical_dtype, is_decimal_dtype, is_list_dtype, - is_struct_dtype + is_struct_dtype, ) -import cudf._lib as libcudfxx from cpython.buffer cimport PyObject_CheckBuffer from libc.stdint cimport uintptr_t -from libcpp.pair cimport pair from libcpp cimport bool -from libcpp.memory cimport unique_ptr, make_unique -from libcpp.vector cimport vector +from libcpp.memory cimport make_unique, unique_ptr +from libcpp.pair cimport pair from libcpp.utility cimport move +from libcpp.vector cimport vector + +from rmm._lib.device_buffer cimport DeviceBuffer + from cudf._lib.cpp.strings.convert.convert_integers cimport ( - from_integers as cpp_from_integers + from_integers as cpp_from_integers, ) -from rmm._lib.device_buffer cimport DeviceBuffer +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types from cudf._lib.types cimport ( - underlying_type_t_type_id, dtype_from_column_view, - dtype_to_data_type + dtype_to_data_type, + underlying_type_t_type_id, ) + from cudf._lib.null_mask import bitmask_allocation_size_bytes +cimport cudf._lib.cpp.types as libcudf_types +cimport cudf._lib.cpp.unary as libcudf_unary from cudf._lib.cpp.column.column cimport column, column_contents -from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.column.column_factories cimport ( make_column_from_scalar as cpp_make_column_from_scalar, - make_numeric_column + make_numeric_column, ) +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.scalar cimport DeviceScalar -cimport cudf._lib.cpp.types as libcudf_types -cimport cudf._lib.cpp.unary as libcudf_unary cdef class Column: diff --git a/python/cudf/cudf/_lib/concat.pyx b/python/cudf/cudf/_lib/concat.pyx index cef93798601..86778e0a9e1 100644 --- a/python/cudf/cudf/_lib/concat.pyx +++ b/python/cudf/cudf/_lib/concat.pyx @@ -1,29 +1,29 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.memory cimport unique_ptr, make_unique -from libcpp.vector cimport vector +from libcpp.memory cimport make_unique, unique_ptr from libcpp.utility cimport move +from libcpp.vector cimport vector +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column, column_view from cudf._lib.cpp.concatenate cimport ( - concatenate_masks as libcudf_concatenate_masks, concatenate_columns as libcudf_concatenate_columns, - concatenate_tables as libcudf_concatenate_tables + concatenate_masks as libcudf_concatenate_masks, + concatenate_tables as libcudf_concatenate_tables, ) -from cudf._lib.cpp.column.column cimport column, column_view from cudf._lib.cpp.table.table cimport table, table_view - -from cudf._lib.column cimport Column from cudf._lib.table cimport Table from cudf._lib.utils cimport ( make_column_views, + make_table_data_views, make_table_views, - make_table_data_views ) from cudf.core.buffer import Buffer -from rmm._lib.device_buffer cimport device_buffer, DeviceBuffer +from rmm._lib.device_buffer cimport DeviceBuffer, device_buffer + cpdef concat_masks(object columns): cdef device_buffer c_result diff --git a/python/cudf/cudf/_lib/copying.pxd b/python/cudf/cudf/_lib/copying.pxd index 1668ef05f3f..8a288c66ea9 100644 --- a/python/cudf/cudf/_lib/copying.pxd +++ b/python/cudf/cudf/_lib/copying.pxd @@ -1,8 +1,8 @@ # Copyright (c) 2021, NVIDIA CORPORATION. +from cudf._lib.cpp.copying cimport packed_columns from cudf._lib.table cimport Table -from cudf._lib.cpp.copying cimport packed_columns cdef class _CPackedColumns: cdef packed_columns c_obj diff --git a/python/cudf/cudf/_lib/copying.pyx b/python/cudf/cudf/_lib/copying.pyx index 9ad552a0acb..71462ecafa1 100644 --- a/python/cudf/cudf/_lib/copying.pyx +++ b/python/cudf/cudf/_lib/copying.pyx @@ -4,37 +4,36 @@ import pickle import pandas as pd +from libc.stdint cimport int32_t, int64_t, uint8_t, uintptr_t from libcpp cimport bool -from libcpp.memory cimport make_unique, unique_ptr, shared_ptr, make_shared -from libcpp.vector cimport vector +from libcpp.memory cimport make_shared, make_unique, shared_ptr, unique_ptr from libcpp.utility cimport move -from libc.stdint cimport int32_t, int64_t, uint8_t, uintptr_t +from libcpp.vector cimport vector from rmm._lib.device_buffer cimport DeviceBuffer, device_buffer from cudf._lib.column cimport Column + from cudf._lib.scalar import as_device_scalar + from cudf._lib.scalar cimport DeviceScalar from cudf._lib.table cimport Table -from cudf._lib.reduce import minmax +from cudf._lib.reduce import minmax from cudf.core.abc import Serializable +cimport cudf._lib.cpp.copying as cpp_copying from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.libcpp.functional cimport reference_wrapper +from cudf._lib.cpp.lists.gather cimport ( + segmented_gather as cpp_segmented_gather, +) +from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view -from cudf._lib.cpp.lists.gather cimport ( - segmented_gather as cpp_segmented_gather -) -cimport cudf._lib.cpp.copying as cpp_copying # workaround for https://github.com/cython/cython/issues/3885 ctypedef const scalar constscalar diff --git a/python/cudf/cudf/_lib/cpp/aggregation.pxd b/python/cudf/cudf/_lib/cpp/aggregation.pxd index 839bdae7427..b13815c925d 100644 --- a/python/cudf/cudf/_lib/cpp/aggregation.pxd +++ b/python/cudf/cudf/_lib/cpp/aggregation.pxd @@ -1,14 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.string cimport string from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.vector cimport vector from cudf._lib.cpp.types cimport ( - size_type, data_type, interpolation, - null_policy + null_policy, + size_type, ) diff --git a/python/cudf/cudf/_lib/cpp/binaryop.pxd b/python/cudf/cudf/_lib/cpp/binaryop.pxd index 2e36070a164..3557ecd8487 100644 --- a/python/cudf/cudf/_lib/cpp/binaryop.pxd +++ b/python/cudf/cudf/_lib/cpp/binaryop.pxd @@ -4,11 +4,10 @@ from libcpp.memory cimport unique_ptr from libcpp.string cimport string from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport ( - data_type -) +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.types cimport data_type + cdef extern from "cudf/binaryop.hpp" namespace "cudf" nogil: ctypedef enum binary_operator: diff --git a/python/cudf/cudf/_lib/cpp/column/column.pxd b/python/cudf/cudf/_lib/cpp/column/column.pxd index 8e880337f94..205a1548c54 100644 --- a/python/cudf/cudf/_lib/cpp/column/column.pxd +++ b/python/cudf/cudf/_lib/cpp/column/column.pxd @@ -1,14 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector -from libcpp cimport bool from rmm._lib.device_buffer cimport device_buffer -from cudf._lib.cpp.types cimport size_type, data_type -from cudf._lib.cpp.column.column_view cimport ( - column_view, mutable_column_view -) + +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view +from cudf._lib.cpp.types cimport data_type, size_type + cdef extern from "cudf/column/column.hpp" namespace "cudf" nogil: cdef cppclass column_contents "cudf::column::contents": diff --git a/python/cudf/cudf/_lib/cpp/column/column_factories.pxd b/python/cudf/cudf/_lib/cpp/column/column_factories.pxd index 1da72160dfb..0f22e788bd7 100644 --- a/python/cudf/cudf/_lib/cpp/column/column_factories.pxd +++ b/python/cudf/cudf/_lib/cpp/column/column_factories.pxd @@ -1,14 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.types cimport ( - data_type, - mask_state, - size_type, -) +from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.scalar.scalar cimport scalar -from libcpp.memory cimport unique_ptr +from cudf._lib.cpp.types cimport data_type, mask_state, size_type + cdef extern from "cudf/column/column_factories.hpp" namespace "cudf" nogil: cdef unique_ptr[column] make_numeric_column(data_type type, diff --git a/python/cudf/cudf/_lib/cpp/column/column_view.pxd b/python/cudf/cudf/_lib/cpp/column/column_view.pxd index e711fd62f8f..39c1c958531 100644 --- a/python/cudf/cudf/_lib/cpp/column/column_view.pxd +++ b/python/cudf/cudf/_lib/cpp/column/column_view.pxd @@ -1,13 +1,9 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp cimport bool +from libcpp.vector cimport vector -from cudf._lib.cpp.types cimport ( - size_type, - data_type, - bitmask_type -) +from cudf._lib.cpp.types cimport bitmask_type, data_type, size_type cdef extern from "cudf/column/column_view.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/concatenate.pxd b/python/cudf/cudf/_lib/cpp/concatenate.pxd index c776d23aa85..05068318962 100644 --- a/python/cudf/cudf/_lib/cpp/concatenate.pxd +++ b/python/cudf/cudf/_lib/cpp/concatenate.pxd @@ -3,11 +3,12 @@ from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector +from rmm._lib.device_buffer cimport device_buffer + from cudf._lib.cpp.column.column cimport column, column_view from cudf._lib.cpp.table.table cimport table, table_view from cudf._lib.cpp.utilities.host_span cimport host_span -from rmm._lib.device_buffer cimport device_buffer cdef extern from "cudf/concatenate.hpp" namespace "cudf" nogil: # The versions of concatenate taking vectors don't exist in libcudf diff --git a/python/cudf/cudf/_lib/cpp/copying.pxd b/python/cudf/cudf/_lib/cpp/copying.pxd index 1f24f51e9a9..29a6518fae8 100644 --- a/python/cudf/cudf/_lib/cpp/copying.pxd +++ b/python/cudf/cudf/_lib/cpp/copying.pxd @@ -1,17 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from rmm._lib.device_buffer cimport device_buffer - -from libcpp cimport bool from libc.stdint cimport int32_t, int64_t, uint8_t +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector +from rmm._lib.device_buffer cimport device_buffer + from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.libcpp.functional cimport reference_wrapper from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table diff --git a/python/cudf/cudf/_lib/cpp/filling.pxd b/python/cudf/cudf/_lib/cpp/filling.pxd index 79bf3c496e8..42bdd827452 100644 --- a/python/cudf/cudf/_lib/cpp/filling.pxd +++ b/python/cudf/cudf/_lib/cpp/filling.pxd @@ -4,15 +4,11 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.types cimport size_type cdef extern from "cudf/filling.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/gpuarrow.pxd b/python/cudf/cudf/_lib/cpp/gpuarrow.pxd index 3e21d784b6f..6ebae78b5cd 100644 --- a/python/cudf/cudf/_lib/cpp/gpuarrow.pxd +++ b/python/cudf/cudf/_lib/cpp/gpuarrow.pxd @@ -1,13 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from pyarrow.includes.libarrow_cuda cimport CCudaBufferReader from pyarrow.includes.libarrow cimport ( - CStatus, - CMessage, CBufferReader, - CMessageReader + CMessage, + CMessageReader, + CStatus, ) +from pyarrow.includes.libarrow_cuda cimport CCudaBufferReader + cdef extern from "cudf/ipc.hpp" nogil: diff --git a/python/cudf/cudf/_lib/cpp/groupby.pxd b/python/cudf/cudf/_lib/cpp/groupby.pxd index af09b27d916..2d8f251799d 100644 --- a/python/cudf/cudf/_lib/cpp/groupby.pxd +++ b/python/cudf/cudf/_lib/cpp/groupby.pxd @@ -1,19 +1,19 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -from libcpp.vector cimport vector +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.pair cimport pair -from libcpp cimport bool +from libcpp.vector cimport vector +from cudf._lib.cpp.aggregation cimport aggregation +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.libcpp.functional cimport reference_wrapper +from cudf._lib.cpp.replace cimport replace_policy +from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.aggregation cimport aggregation -from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.types cimport size_type, order, null_order, null_policy -from cudf._lib.cpp.replace cimport replace_policy +from cudf._lib.cpp.types cimport null_order, null_policy, order, size_type from cudf._lib.cpp.utilities.host_span cimport host_span # workaround for https://github.com/cython/cython/issues/3885 diff --git a/python/cudf/cudf/_lib/cpp/hash.pxd b/python/cudf/cudf/_lib/cpp/hash.pxd index 5cecf50cd98..f07a6c0f046 100644 --- a/python/cudf/cudf/_lib/cpp/hash.pxd +++ b/python/cudf/cudf/_lib/cpp/hash.pxd @@ -4,10 +4,10 @@ from libc.stdint cimport uint32_t from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.types as libcudf_types cdef extern from "cudf/hashing.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/interop.pxd b/python/cudf/cudf/_lib/cpp/interop.pxd index ed082e26853..e81f0d617fb 100644 --- a/python/cudf/cudf/_lib/cpp/interop.pxd +++ b/python/cudf/cudf/_lib/cpp/interop.pxd @@ -1,16 +1,16 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.memory cimport unique_ptr -from libcpp.memory cimport shared_ptr -from libcpp.vector cimport vector +from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string - +from libcpp.vector cimport vector from pyarrow.lib cimport CTable -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types + +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view + cdef extern from "dlpack/dlpack.h" nogil: ctypedef struct DLManagedTensor: void(*deleter)(DLManagedTensor*) except + diff --git a/python/cudf/cudf/_lib/cpp/io/avro.pxd b/python/cudf/cudf/_lib/cpp/io/avro.pxd index ac726cdd04d..6efe42e5208 100644 --- a/python/cudf/cudf/_lib/cpp/io/avro.pxd +++ b/python/cudf/cudf/_lib/cpp/io/avro.pxd @@ -3,8 +3,8 @@ from libcpp.string cimport string from libcpp.vector cimport vector -from cudf._lib.cpp.types cimport size_type cimport cudf._lib.cpp.io.types as cudf_io_types +from cudf._lib.cpp.types cimport size_type cdef extern from "cudf/io/avro.hpp" \ diff --git a/python/cudf/cudf/_lib/cpp/io/csv.pxd b/python/cudf/cudf/_lib/cpp/io/csv.pxd index 6b6d36b3899..c5e235b5697 100644 --- a/python/cudf/cudf/_lib/cpp/io/csv.pxd +++ b/python/cudf/cudf/_lib/cpp/io/csv.pxd @@ -1,14 +1,15 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport uint8_t from libcpp cimport bool +from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string from libcpp.vector cimport vector -from libcpp.memory cimport shared_ptr, unique_ptr -from libc.stdint cimport uint8_t -from cudf._lib.cpp.types cimport data_type, size_type cimport cudf._lib.cpp.io.types as cudf_io_types cimport cudf._lib.cpp.table.table_view as cudf_table_view +from cudf._lib.cpp.types cimport data_type, size_type + cdef extern from "cudf/io/csv.hpp" \ namespace "cudf::io" nogil: diff --git a/python/cudf/cudf/_lib/cpp/io/json.pxd b/python/cudf/cudf/_lib/cpp/io/json.pxd index 31a5afa2bac..6f20195e87f 100644 --- a/python/cudf/cudf/_lib/cpp/io/json.pxd +++ b/python/cudf/cudf/_lib/cpp/io/json.pxd @@ -1,14 +1,15 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport uint8_t from libcpp cimport bool +from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string from libcpp.vector cimport vector -from libcpp.memory cimport shared_ptr, unique_ptr -from libc.stdint cimport uint8_t -from cudf._lib.cpp.types cimport data_type, size_type cimport cudf._lib.cpp.io.types as cudf_io_types cimport cudf._lib.cpp.table.table_view as cudf_table_view +from cudf._lib.cpp.types cimport data_type, size_type + cdef extern from "cudf/io/json.hpp" \ namespace "cudf::io" nogil: diff --git a/python/cudf/cudf/_lib/cpp/io/orc.pxd b/python/cudf/cudf/_lib/cpp/io/orc.pxd index 85e1cd95404..d89af43028d 100644 --- a/python/cudf/cudf/_lib/cpp/io/orc.pxd +++ b/python/cudf/cudf/_lib/cpp/io/orc.pxd @@ -1,14 +1,15 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. +from libc.stdint cimport uint8_t from libcpp cimport bool +from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string from libcpp.vector cimport vector -from libcpp.memory cimport shared_ptr, unique_ptr -from libc.stdint cimport uint8_t -from cudf._lib.cpp.types cimport data_type, size_type cimport cudf._lib.cpp.io.types as cudf_io_types cimport cudf._lib.cpp.table.table_view as cudf_table_view +from cudf._lib.cpp.types cimport data_type, size_type + cdef extern from "cudf/io/orc.hpp" \ namespace "cudf::io" nogil: diff --git a/python/cudf/cudf/_lib/cpp/io/orc_metadata.pxd b/python/cudf/cudf/_lib/cpp/io/orc_metadata.pxd index e1128884491..57be1b1c90c 100644 --- a/python/cudf/cudf/_lib/cpp/io/orc_metadata.pxd +++ b/python/cudf/cudf/_lib/cpp/io/orc_metadata.pxd @@ -1,7 +1,7 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp.string cimport string +from libcpp.vector cimport vector cimport cudf._lib.cpp.io.types as cudf_io_types diff --git a/python/cudf/cudf/_lib/cpp/io/parquet.pxd b/python/cudf/cudf/_lib/cpp/io/parquet.pxd index 39da6b26502..e2053f8ce4f 100644 --- a/python/cudf/cudf/_lib/cpp/io/parquet.pxd +++ b/python/cudf/cudf/_lib/cpp/io/parquet.pxd @@ -1,15 +1,16 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. +from libc.stdint cimport uint8_t from libcpp cimport bool -from libcpp.string cimport string -from libcpp.vector cimport vector from libcpp.map cimport map from libcpp.memory cimport shared_ptr, unique_ptr -from libc.stdint cimport uint8_t +from libcpp.string cimport string +from libcpp.vector cimport vector -from cudf._lib.cpp.types cimport data_type, size_type cimport cudf._lib.cpp.io.types as cudf_io_types cimport cudf._lib.cpp.table.table_view as cudf_table_view +from cudf._lib.cpp.types cimport data_type, size_type + cdef extern from "cudf/io/parquet.hpp" namespace "cudf::io" nogil: cdef cppclass parquet_reader_options: diff --git a/python/cudf/cudf/_lib/cpp/io/types.pxd b/python/cudf/cudf/_lib/cpp/io/types.pxd index 907d7763579..7fa6406bd29 100644 --- a/python/cudf/cudf/_lib/cpp/io/types.pxd +++ b/python/cudf/cudf/_lib/cpp/io/types.pxd @@ -1,13 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.memory cimport unique_ptr, shared_ptr -from libcpp.string cimport string from libcpp.map cimport map +from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.pair cimport pair +from libcpp.string cimport string from libcpp.vector cimport vector -from libcpp.pair cimport pair from pyarrow.includes.libarrow cimport CRandomAccessFile + from cudf._lib.cpp.table.table cimport table diff --git a/python/cudf/cudf/_lib/cpp/join.pxd b/python/cudf/cudf/_lib/cpp/join.pxd index c221fea926d..171658c78ee 100644 --- a/python/cudf/cudf/_lib/cpp/join.pxd +++ b/python/cudf/cudf/_lib/cpp/join.pxd @@ -1,18 +1,16 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.memory cimport unique_ptr -from libcpp.vector cimport vector -from libcpp.pair cimport pair from libcpp cimport bool -from libcpp.pair cimport pair from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair +from libcpp.vector cimport vector + +from rmm._lib.device_uvector cimport device_uvector from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type -from rmm._lib.device_uvector cimport device_uvector - ctypedef unique_ptr[device_uvector[size_type]] gather_map_type diff --git a/python/cudf/cudf/_lib/cpp/labeling.pxd b/python/cudf/cudf/_lib/cpp/labeling.pxd index 996ae4f9e38..af9c4bb9a04 100644 --- a/python/cudf/cudf/_lib/cpp/labeling.pxd +++ b/python/cudf/cudf/_lib/cpp/labeling.pxd @@ -5,6 +5,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/labeling/label_bins.hpp" namespace "cudf" nogil: ctypedef enum inclusive: YES "cudf::inclusive::YES" diff --git a/python/cudf/cudf/_lib/cpp/lists/combine.pxd b/python/cudf/cudf/_lib/cpp/lists/combine.pxd index 164253e39b5..a7ad8e7ba41 100644 --- a/python/cudf/cudf/_lib/cpp/lists/combine.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/combine.pxd @@ -6,6 +6,7 @@ from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table_view cimport table_view + cdef extern from "cudf/lists/combine.hpp" namespace \ "cudf::lists" nogil: diff --git a/python/cudf/cudf/_lib/cpp/lists/contains.pxd b/python/cudf/cudf/_lib/cpp/lists/contains.pxd index ec2f61d08fa..5790ae4e787 100644 --- a/python/cudf/cudf/_lib/cpp/lists/contains.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/contains.pxd @@ -1,12 +1,12 @@ # Copyright (c) 2021, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view +from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.column.column_view cimport column_view cdef extern from "cudf/lists/contains.hpp" namespace "cudf::lists" nogil: cdef unique_ptr[column] contains( diff --git a/python/cudf/cudf/_lib/cpp/lists/count_elements.pxd b/python/cudf/cudf/_lib/cpp/lists/count_elements.pxd index 57d6daefd37..9be38f26237 100644 --- a/python/cudf/cudf/_lib/cpp/lists/count_elements.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/count_elements.pxd @@ -5,5 +5,6 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view + cdef extern from "cudf/lists/count_elements.hpp" namespace "cudf::lists" nogil: cdef unique_ptr[column] count_elements(const lists_column_view) except + diff --git a/python/cudf/cudf/_lib/cpp/lists/drop_list_duplicates.pxd b/python/cudf/cudf/_lib/cpp/lists/drop_list_duplicates.pxd index 40b1836f932..81d54104320 100644 --- a/python/cudf/cudf/_lib/cpp/lists/drop_list_duplicates.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/drop_list_duplicates.pxd @@ -2,9 +2,10 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.types cimport null_equality, nan_equality +from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view +from cudf._lib.cpp.types cimport nan_equality, null_equality + cdef extern from "cudf/lists/drop_list_duplicates.hpp" \ namespace "cudf::lists" nogil: diff --git a/python/cudf/cudf/_lib/cpp/lists/explode.pxd b/python/cudf/cudf/_lib/cpp/lists/explode.pxd index cd2d44d2e42..c3e15dd203c 100644 --- a/python/cudf/cudf/_lib/cpp/lists/explode.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/explode.pxd @@ -6,6 +6,7 @@ from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/lists/explode.hpp" namespace "cudf" nogil: cdef unique_ptr[table] explode_outer( const table_view, diff --git a/python/cudf/cudf/_lib/cpp/lists/extract.pxd b/python/cudf/cudf/_lib/cpp/lists/extract.pxd index 89fa893c17d..a023f728989 100644 --- a/python/cudf/cudf/_lib/cpp/lists/extract.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/extract.pxd @@ -4,9 +4,9 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view - from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/lists/extract.hpp" namespace "cudf::lists" nogil: cdef unique_ptr[column] extract_list_element( const lists_column_view, diff --git a/python/cudf/cudf/_lib/cpp/lists/lists_column_view.pxd b/python/cudf/cudf/_lib/cpp/lists/lists_column_view.pxd index 3290f52fba7..aa18ede41bd 100644 --- a/python/cudf/cudf/_lib/cpp/lists/lists_column_view.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/lists_column_view.pxd @@ -1,8 +1,6 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport ( - column_view, mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view cdef extern from "cudf/lists/lists_column_view.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/lists/sorting.pxd b/python/cudf/cudf/_lib/cpp/lists/sorting.pxd index 55e8e09427c..2115885ed95 100644 --- a/python/cudf/cudf/_lib/cpp/lists/sorting.pxd +++ b/python/cudf/cudf/_lib/cpp/lists/sorting.pxd @@ -2,9 +2,9 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.types cimport order, null_order from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view +from cudf._lib.cpp.types cimport null_order, order cdef extern from "cudf/lists/sorting.hpp" namespace "cudf::lists" nogil: diff --git a/python/cudf/cudf/_lib/cpp/merge.pxd b/python/cudf/cudf/_lib/cpp/merge.pxd index b2d3d802e76..32fe14ac479 100644 --- a/python/cudf/cudf/_lib/cpp/merge.pxd +++ b/python/cudf/cudf/_lib/cpp/merge.pxd @@ -1,11 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr +from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.types as libcudf_types cdef extern from "cudf/merge.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/null_mask.pxd b/python/cudf/cudf/_lib/cpp/null_mask.pxd index b83c7a433c8..c225a16297b 100644 --- a/python/cudf/cudf/_lib/cpp/null_mask.pxd +++ b/python/cudf/cudf/_lib/cpp/null_mask.pxd @@ -4,8 +4,8 @@ from libc.stdint cimport int32_t from rmm._lib.device_buffer cimport device_buffer -from cudf._lib.cpp.column.column_view cimport column_view cimport cudf._lib.cpp.types as libcudf_types +from cudf._lib.cpp.column.column_view cimport column_view ctypedef int32_t underlying_type_t_mask_state diff --git a/python/cudf/cudf/_lib/cpp/nvtext/edit_distance.pxd b/python/cudf/cudf/_lib/cpp/nvtext/edit_distance.pxd index 0d846702c9d..11de596ec8f 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/edit_distance.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/edit_distance.pxd @@ -6,6 +6,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "nvtext/edit_distance.hpp" namespace "nvtext" nogil: cdef unique_ptr[column] edit_distance( diff --git a/python/cudf/cudf/_lib/cpp/nvtext/generate_ngrams.pxd b/python/cudf/cudf/_lib/cpp/nvtext/generate_ngrams.pxd index 52a91cba057..06147df38f2 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/generate_ngrams.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/generate_ngrams.pxd @@ -7,6 +7,7 @@ from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.types cimport size_type + cdef extern from "nvtext/generate_ngrams.hpp" namespace "nvtext" nogil: cdef unique_ptr[column] generate_ngrams( diff --git a/python/cudf/cudf/_lib/cpp/nvtext/ngrams_tokenize.pxd b/python/cudf/cudf/_lib/cpp/nvtext/ngrams_tokenize.pxd index d6145a8048d..d716df22546 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/ngrams_tokenize.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/ngrams_tokenize.pxd @@ -7,6 +7,7 @@ from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.types cimport size_type + cdef extern from "nvtext/ngrams_tokenize.hpp" namespace "nvtext" nogil: cdef unique_ptr[column] ngrams_tokenize( diff --git a/python/cudf/cudf/_lib/cpp/nvtext/normalize.pxd b/python/cudf/cudf/_lib/cpp/nvtext/normalize.pxd index 7d8ec891692..f012670317a 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/normalize.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/normalize.pxd @@ -6,6 +6,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "nvtext/normalize.hpp" namespace "nvtext" nogil: cdef unique_ptr[column] normalize_spaces( diff --git a/python/cudf/cudf/_lib/cpp/nvtext/replace.pxd b/python/cudf/cudf/_lib/cpp/nvtext/replace.pxd index 2de562e91b4..c4e5258a710 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/replace.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/replace.pxd @@ -2,10 +2,10 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport size_type cdef extern from "nvtext/replace.hpp" namespace "nvtext" nogil: diff --git a/python/cudf/cudf/_lib/cpp/nvtext/stemmer.pxd b/python/cudf/cudf/_lib/cpp/nvtext/stemmer.pxd index b8b816c212e..5a92b45b6dd 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/stemmer.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/stemmer.pxd @@ -7,6 +7,7 @@ from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport size_type + cdef extern from "nvtext/stemmer.hpp" namespace "nvtext" nogil: ctypedef enum letter_type: CONSONANT 'nvtext::letter_type::CONSONANT' diff --git a/python/cudf/cudf/_lib/cpp/nvtext/subword_tokenize.pxd b/python/cudf/cudf/_lib/cpp/nvtext/subword_tokenize.pxd index 013ce9de8f4..cdb39e3c7fa 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/subword_tokenize.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/subword_tokenize.pxd @@ -1,10 +1,9 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport uint16_t, uint32_t from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.string cimport string -from libc.stdint cimport uint16_t, uint32_t - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view diff --git a/python/cudf/cudf/_lib/cpp/nvtext/tokenize.pxd b/python/cudf/cudf/_lib/cpp/nvtext/tokenize.pxd index 2442c12de82..8b80f50e381 100644 --- a/python/cudf/cudf/_lib/cpp/nvtext/tokenize.pxd +++ b/python/cudf/cudf/_lib/cpp/nvtext/tokenize.pxd @@ -6,6 +6,7 @@ from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar + cdef extern from "nvtext/tokenize.hpp" namespace "nvtext" nogil: cdef unique_ptr[column] tokenize( diff --git a/python/cudf/cudf/_lib/cpp/partitioning.pxd b/python/cudf/cudf/_lib/cpp/partitioning.pxd index 8f89c09e52c..5c58dbcc4ac 100644 --- a/python/cudf/cudf/_lib/cpp/partitioning.pxd +++ b/python/cudf/cudf/_lib/cpp/partitioning.pxd @@ -1,15 +1,15 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libc.stdint cimport uint32_t -from libcpp.pair cimport pair from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.column.column_view cimport column_view -cimport cudf._lib.cpp.types as libcudf_types cdef extern from "cudf/partitioning.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/quantiles.pxd b/python/cudf/cudf/_lib/cpp/quantiles.pxd index f7817dfb97f..03fda16856c 100644 --- a/python/cudf/cudf/_lib/cpp/quantiles.pxd +++ b/python/cudf/cudf/_lib/cpp/quantiles.pxd @@ -1,19 +1,18 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr +from libcpp.vector cimport vector from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view - from cudf._lib.cpp.types cimport ( interpolation, null_order, - order_info, order, + order_info, sorted, ) diff --git a/python/cudf/cudf/_lib/cpp/reduce.pxd b/python/cudf/cudf/_lib/cpp/reduce.pxd index dfe1ffd3669..53c8cd59468 100644 --- a/python/cudf/cudf/_lib/cpp/reduce.pxd +++ b/python/cudf/cudf/_lib/cpp/reduce.pxd @@ -1,14 +1,15 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.types cimport data_type -from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.column.column cimport column -from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.aggregation cimport aggregation from libcpp.memory cimport unique_ptr from libcpp.utility cimport pair +from cudf._lib.aggregation cimport aggregation +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.types cimport data_type +from cudf._lib.scalar cimport DeviceScalar + cdef extern from "cudf/reduction.hpp" namespace "cudf" nogil: cdef unique_ptr[scalar] cpp_reduce "cudf::reduce" ( diff --git a/python/cudf/cudf/_lib/cpp/replace.pxd b/python/cudf/cudf/_lib/cpp/replace.pxd index 6fd844acb75..c1ec89a6233 100644 --- a/python/cudf/cudf/_lib/cpp/replace.pxd +++ b/python/cudf/cudf/_lib/cpp/replace.pxd @@ -2,14 +2,12 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types -from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view +from cudf._lib.cpp.scalar.scalar cimport scalar + cdef extern from "cudf/replace.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/reshape.pxd b/python/cudf/cudf/_lib/cpp/reshape.pxd index 2985b9282b3..5b9d40aa2ad 100644 --- a/python/cudf/cudf/_lib/cpp/reshape.pxd +++ b/python/cudf/cudf/_lib/cpp/reshape.pxd @@ -2,10 +2,11 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/reshape.hpp" namespace "cudf" nogil: cdef unique_ptr[column] interleave_columns( diff --git a/python/cudf/cudf/_lib/cpp/rolling.pxd b/python/cudf/cudf/_lib/cpp/rolling.pxd index 4ccc0f5ae9b..df2e833edc2 100644 --- a/python/cudf/cudf/_lib/cpp/rolling.pxd +++ b/python/cudf/cudf/_lib/cpp/rolling.pxd @@ -2,12 +2,12 @@ from libcpp.memory cimport unique_ptr -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types -from cudf._lib.cpp.types cimport size_type +from cudf._lib.cpp.aggregation cimport rolling_aggregation from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.aggregation cimport rolling_aggregation +from cudf._lib.cpp.types cimport size_type cdef extern from "cudf/rolling.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/round.pxd b/python/cudf/cudf/_lib/cpp/round.pxd index 78f18dcacce..66d76c35d72 100644 --- a/python/cudf/cudf/_lib/cpp/round.pxd +++ b/python/cudf/cudf/_lib/cpp/round.pxd @@ -6,6 +6,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/round.hpp" namespace "cudf" nogil: ctypedef enum rounding_method "cudf::rounding_method": diff --git a/python/cudf/cudf/_lib/cpp/scalar/scalar.pxd b/python/cudf/cudf/_lib/cpp/scalar/scalar.pxd index 771ec9100d1..930ebaa1bea 100644 --- a/python/cudf/cudf/_lib/cpp/scalar/scalar.pxd +++ b/python/cudf/cudf/_lib/cpp/scalar/scalar.pxd @@ -1,16 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libc.stdint cimport ( - int32_t, int64_t -) +from libc.stdint cimport int32_t, int64_t from libcpp cimport bool from libcpp.string cimport string +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport data_type from cudf._lib.cpp.wrappers.decimals cimport scale_type -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.table.table_view cimport table_view cdef extern from "cudf/scalar/scalar.hpp" namespace "cudf" nogil: cdef cppclass scalar: diff --git a/python/cudf/cudf/_lib/cpp/search.pxd b/python/cudf/cudf/_lib/cpp/search.pxd index 521b681dc24..4df73881ea5 100644 --- a/python/cudf/cudf/_lib/cpp/search.pxd +++ b/python/cudf/cudf/_lib/cpp/search.pxd @@ -1,12 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr +from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.types as libcudf_types cdef extern from "cudf/search.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/sorting.pxd b/python/cudf/cudf/_lib/cpp/sorting.pxd index 845457e423f..d614ef64ee2 100644 --- a/python/cudf/cudf/_lib/cpp/sorting.pxd +++ b/python/cudf/cudf/_lib/cpp/sorting.pxd @@ -4,13 +4,14 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.types as libcudf_types + cdef extern from "cudf/sorting.hpp" namespace "cudf" nogil: ctypedef enum rank_method: diff --git a/python/cudf/cudf/_lib/cpp/stream_compaction.pxd b/python/cudf/cudf/_lib/cpp/stream_compaction.pxd index c575f4eb17d..5b81d369ef5 100644 --- a/python/cudf/cudf/_lib/cpp/stream_compaction.pxd +++ b/python/cudf/cudf/_lib/cpp/stream_compaction.pxd @@ -1,17 +1,20 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector -from libcpp cimport bool -from cudf._lib.types import np_to_cudf_types, cudf_to_np_types +from cudf._lib.types import cudf_to_np_types, np_to_cudf_types -from cudf._lib.cpp.types cimport ( - size_type, null_policy, nan_policy, null_equality -) from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport ( + nan_policy, + null_equality, + null_policy, + size_type, +) cdef extern from "cudf/stream_compaction.hpp" namespace "cudf" \ diff --git a/python/cudf/cudf/_lib/cpp/strings/attributes.pxd b/python/cudf/cudf/_lib/cpp/strings/attributes.pxd index abac963fe94..31133b45b6d 100644 --- a/python/cudf/cudf/_lib/cpp/strings/attributes.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/attributes.pxd @@ -5,6 +5,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/strings/attributes.hpp" namespace "cudf::strings" nogil: cdef unique_ptr[column] count_characters( diff --git a/python/cudf/cudf/_lib/cpp/strings/capitalize.pxd b/python/cudf/cudf/_lib/cpp/strings/capitalize.pxd index eb24c6ab417..02a4469f495 100644 --- a/python/cudf/cudf/_lib/cpp/strings/capitalize.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/capitalize.pxd @@ -4,6 +4,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/strings/capitalize.hpp" namespace "cudf::strings" nogil: cdef unique_ptr[column] capitalize( const column_view & strings) except + diff --git a/python/cudf/cudf/_lib/cpp/strings/case.pxd b/python/cudf/cudf/_lib/cpp/strings/case.pxd index 7c38657a43e..01cd08c10ff 100644 --- a/python/cudf/cudf/_lib/cpp/strings/case.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/case.pxd @@ -4,6 +4,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/strings/case.hpp" namespace "cudf::strings" nogil: cdef unique_ptr[column] to_lower( const column_view & strings) except + diff --git a/python/cudf/cudf/_lib/cpp/strings/char_types.pxd b/python/cudf/cudf/_lib/cpp/strings/char_types.pxd index 934269c6f25..ae921c6ead9 100644 --- a/python/cudf/cudf/_lib/cpp/strings/char_types.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/char_types.pxd @@ -1,10 +1,12 @@ # Copyright (c) 2021, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.column.column_view cimport column_view + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar + cdef extern from "cudf/strings/char_types/char_types.hpp" \ namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/combine.pxd b/python/cudf/cudf/_lib/cpp/strings/combine.pxd index 35d7516d127..2b10427283f 100644 --- a/python/cudf/cudf/_lib/cpp/strings/combine.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/combine.pxd @@ -1,10 +1,12 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.table.table_view cimport table_view + cdef extern from "cudf/strings/combine.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/contains.pxd b/python/cudf/cudf/_lib/cpp/strings/contains.pxd index e6fb9127814..bde0b4fdfb7 100644 --- a/python/cudf/cudf/_lib/cpp/strings/contains.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/contains.pxd @@ -1,9 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view cdef extern from "cudf/strings/contains.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_booleans.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_booleans.pxd index ca494696ae8..96cb43973f1 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_booleans.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_booleans.pxd @@ -1,9 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_booleans.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_datetime.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_datetime.pxd index 4bd57a16d64..5a9228608e5 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_datetime.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_datetime.pxd @@ -1,11 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr +from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport data_type -from libcpp.memory cimport unique_ptr -from libcpp.string cimport string cdef extern from "cudf/strings/convert/convert_datetime.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_durations.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_durations.pxd index 98faebfcaa2..8c54fd52aa2 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_durations.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_durations.pxd @@ -1,11 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr +from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport data_type -from libcpp.memory cimport unique_ptr -from libcpp.string cimport string cdef extern from "cudf/strings/convert/convert_durations.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_fixed_point.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_fixed_point.pxd index 77d72acb670..a993c5b17b8 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_fixed_point.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_fixed_point.pxd @@ -1,10 +1,11 @@ # Copyright (c) 2021, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport data_type -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_fixed_point.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_floats.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_floats.pxd index 55a84b60efd..6388f43077d 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_floats.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_floats.pxd @@ -1,10 +1,11 @@ # Copyright (c) 2021, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport data_type -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_floats.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_integers.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_integers.pxd index ec45b985544..b5443979b81 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_integers.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_integers.pxd @@ -1,10 +1,11 @@ # Copyright (c) 2021, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.types cimport data_type -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_integers.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_ipv4.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_ipv4.pxd index 37eea254605..d6e881caea4 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_ipv4.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_ipv4.pxd @@ -1,9 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_ipv4.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/convert/convert_urls.pxd b/python/cudf/cudf/_lib/cpp/strings/convert/convert_urls.pxd index a7bcb8d8078..5d9991dd610 100644 --- a/python/cudf/cudf/_lib/cpp/strings/convert/convert_urls.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/convert/convert_urls.pxd @@ -1,9 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from libcpp.memory cimport unique_ptr cdef extern from "cudf/strings/convert/convert_urls.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/extract.pxd b/python/cudf/cudf/_lib/cpp/strings/extract.pxd index acec41bddc8..606369c8994 100644 --- a/python/cudf/cudf/_lib/cpp/strings/extract.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/extract.pxd @@ -1,11 +1,11 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2021, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table -from libcpp.string cimport string cdef extern from "cudf/strings/extract.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/find.pxd b/python/cudf/cudf/_lib/cpp/strings/find.pxd index 05451fe0599..953d5c30b2a 100644 --- a/python/cudf/cudf/_lib/cpp/strings/find.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/find.pxd @@ -1,12 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/find.hpp" namespace "cudf::strings" nogil: cdef unique_ptr[column] contains( diff --git a/python/cudf/cudf/_lib/cpp/strings/find_multiple.pxd b/python/cudf/cudf/_lib/cpp/strings/find_multiple.pxd index 286fe72d058..27b19728f60 100644 --- a/python/cudf/cudf/_lib/cpp/strings/find_multiple.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/find_multiple.pxd @@ -1,8 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view + cdef extern from "cudf/strings/find_multiple.hpp" namespace "cudf::strings" \ nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/findall.pxd b/python/cudf/cudf/_lib/cpp/strings/findall.pxd index 818135b6cd0..189d0770b81 100644 --- a/python/cudf/cudf/_lib/cpp/strings/findall.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/findall.pxd @@ -1,11 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table -from libcpp.string cimport string cdef extern from "cudf/strings/findall.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/json.pxd b/python/cudf/cudf/_lib/cpp/strings/json.pxd index c0e215f2085..972e3c99d59 100644 --- a/python/cudf/cudf/_lib/cpp/strings/json.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/json.pxd @@ -1,12 +1,11 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar from libcpp.memory cimport unique_ptr from libcpp.string cimport string from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport scalar, string_scalar cdef extern from "cudf/strings/json.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/padding.pxd b/python/cudf/cudf/_lib/cpp/strings/padding.pxd index af1f235f7ea..2077e687be3 100644 --- a/python/cudf/cudf/_lib/cpp/strings/padding.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/padding.pxd @@ -1,12 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libc.stdint cimport int32_t +from libcpp.memory cimport unique_ptr +from libcpp.string cimport string +from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.scalar.scalar cimport string_scalar -from libcpp.string cimport string -from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/padding.hpp" namespace "cudf::strings" nogil: ctypedef enum pad_side: diff --git a/python/cudf/cudf/_lib/cpp/strings/replace.pxd b/python/cudf/cudf/_lib/cpp/strings/replace.pxd index 312c8fb1753..2a9c6913bb3 100644 --- a/python/cudf/cudf/_lib/cpp/strings/replace.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/replace.pxd @@ -1,13 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type +from libc.stdint cimport int32_t from libcpp.memory cimport unique_ptr from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar -from libcpp.string cimport string -from libc.stdint cimport int32_t +from cudf._lib.cpp.types cimport size_type cdef extern from "cudf/strings/replace.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/replace_re.pxd b/python/cudf/cudf/_lib/cpp/strings/replace_re.pxd index 8d19c67acd0..33ccbc34a8e 100644 --- a/python/cudf/cudf/_lib/cpp/strings/replace_re.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/replace_re.pxd @@ -1,14 +1,15 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type from libcpp.memory cimport unique_ptr from libcpp.string cimport string +from libcpp.vector cimport vector + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.table.table cimport table -from libcpp.string cimport string -from libcpp.vector cimport vector +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/replace_re.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/split/partition.pxd b/python/cudf/cudf/_lib/cpp/strings/split/partition.pxd index cdfa8b78e03..fb83512e9f0 100644 --- a/python/cudf/cudf/_lib/cpp/strings/split/partition.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/split/partition.pxd @@ -1,12 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from libcpp.string cimport string from libcpp.memory cimport unique_ptr +from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.table.table cimport table + cdef extern from "cudf/strings/split/partition.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/split/split.pxd b/python/cudf/cudf/_lib/cpp/strings/split/split.pxd index db9bf91336a..4a90aa233f0 100644 --- a/python/cudf/cudf/_lib/cpp/strings/split/split.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/split/split.pxd @@ -1,12 +1,14 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from libcpp.string cimport string from libcpp.memory cimport unique_ptr +from libcpp.string cimport string + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/split/split.hpp" namespace \ "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/strip.pxd b/python/cudf/cudf/_lib/cpp/strings/strip.pxd index a03917dc44b..82a84fd2d14 100644 --- a/python/cudf/cudf/_lib/cpp/strings/strip.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/strip.pxd @@ -1,9 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar + cdef extern from "cudf/strings/strip.hpp" namespace "cudf::strings" nogil: ctypedef enum strip_type: diff --git a/python/cudf/cudf/_lib/cpp/strings/substring.pxd b/python/cudf/cudf/_lib/cpp/strings/substring.pxd index 0d558ad9670..ec69c5acc03 100644 --- a/python/cudf/cudf/_lib/cpp/strings/substring.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/substring.pxd @@ -1,10 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.column.column_view cimport column_view + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport numeric_scalar +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/substring.hpp" namespace "cudf::strings" nogil: cdef unique_ptr[column] slice_strings( diff --git a/python/cudf/cudf/_lib/cpp/strings/translate.pxd b/python/cudf/cudf/_lib/cpp/strings/translate.pxd index 3f40543a49a..3239ba314e4 100644 --- a/python/cudf/cudf/_lib/cpp/strings/translate.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/translate.pxd @@ -2,13 +2,14 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair +from libcpp.vector cimport vector from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from libcpp.vector cimport vector -from libcpp.pair cimport pair -from cudf._lib.cpp.types cimport char_utf8 from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport char_utf8 + cdef extern from "cudf/strings/translate.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/strings/wrap.pxd b/python/cudf/cudf/_lib/cpp/strings/wrap.pxd index f5fa115b31c..62c791799ad 100644 --- a/python/cudf/cudf/_lib/cpp/strings/wrap.pxd +++ b/python/cudf/cudf/_lib/cpp/strings/wrap.pxd @@ -1,9 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/strings/wrap.hpp" namespace "cudf::strings" nogil: diff --git a/python/cudf/cudf/_lib/cpp/table/table.pxd b/python/cudf/cudf/_lib/cpp/table/table.pxd index ffa8dd1fc98..13e1ceb6430 100644 --- a/python/cudf/cudf/_lib/cpp/table/table.pxd +++ b/python/cudf/cudf/_lib/cpp/table/table.pxd @@ -1,14 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr +from libcpp.vector cimport vector -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.table.table_view cimport ( - table_view, - mutable_table_view -) +from cudf._lib.cpp.table.table_view cimport mutable_table_view, table_view +from cudf._lib.cpp.types cimport size_type + cdef extern from "cudf/table/table.hpp" namespace "cudf" nogil: cdef cppclass table: diff --git a/python/cudf/cudf/_lib/cpp/table/table_view.pxd b/python/cudf/cudf/_lib/cpp/table/table_view.pxd index 7bbfa69836c..728b6d2be4b 100644 --- a/python/cudf/cudf/_lib/cpp/table/table_view.pxd +++ b/python/cudf/cudf/_lib/cpp/table/table_view.pxd @@ -2,11 +2,9 @@ from libcpp.vector cimport vector +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) + cdef extern from "cudf/table/table_view.hpp" namespace "cudf" nogil: cdef cppclass table_view: diff --git a/python/cudf/cudf/_lib/cpp/transform.pxd b/python/cudf/cudf/_lib/cpp/transform.pxd index 5e37336cb94..484e3997f34 100644 --- a/python/cudf/cudf/_lib/cpp/transform.pxd +++ b/python/cudf/cudf/_lib/cpp/transform.pxd @@ -1,21 +1,17 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.string cimport string -from libcpp.pair cimport pair from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair +from libcpp.string cimport string from rmm._lib.device_buffer cimport device_buffer -from cudf._lib.cpp.types cimport ( - bitmask_type, - data_type, - size_type, -) from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport bitmask_type, data_type, size_type cdef extern from "cudf/transform.hpp" namespace "cudf" nogil: diff --git a/python/cudf/cudf/_lib/cpp/unary.pxd b/python/cudf/cudf/_lib/cpp/unary.pxd index b5682ee6694..83a5701eaf0 100644 --- a/python/cudf/cudf/_lib/cpp/unary.pxd +++ b/python/cudf/cudf/_lib/cpp/unary.pxd @@ -2,15 +2,10 @@ from libc.stdint cimport int32_t from libcpp.memory cimport unique_ptr -from cudf._lib.cpp.column.column_view cimport ( - column_view -) -from cudf._lib.cpp.column.column cimport ( - column -) -from cudf._lib.cpp.types cimport ( - data_type -) + +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.types cimport data_type ctypedef int32_t underlying_type_t_unary_op diff --git a/python/cudf/cudf/_lib/cpp/utilities/host_span.pxd b/python/cudf/cudf/_lib/cpp/utilities/host_span.pxd index cbbe3710347..7e591e96373 100644 --- a/python/cudf/cudf/_lib/cpp/utilities/host_span.pxd +++ b/python/cudf/cudf/_lib/cpp/utilities/host_span.pxd @@ -2,6 +2,7 @@ from libcpp.vector cimport vector + cdef extern from "cudf/utilities/span.hpp" namespace "cudf" nogil: cdef cppclass host_span[T]: host_span() except + diff --git a/python/cudf/cudf/_lib/cpp/wrappers/decimals.pxd b/python/cudf/cudf/_lib/cpp/wrappers/decimals.pxd index 9de23fb2595..74efdb08bea 100644 --- a/python/cudf/cudf/_lib/cpp/wrappers/decimals.pxd +++ b/python/cudf/cudf/_lib/cpp/wrappers/decimals.pxd @@ -1,5 +1,6 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from libc.stdint cimport int64_t, int32_t +from libc.stdint cimport int32_t, int64_t + cdef extern from "cudf/fixed_point/fixed_point.hpp" namespace "numeric" nogil: # cython type stub to help resolve to numeric::decimal64 diff --git a/python/cudf/cudf/_lib/csv.pyx b/python/cudf/cudf/_lib/csv.pyx index 1c87096b647..773e81a0a7b 100644 --- a/python/cudf/cudf/_lib/csv.pyx +++ b/python/cudf/cudf/_lib/csv.pyx @@ -3,33 +3,31 @@ from libcpp cimport bool from libcpp.memory cimport make_unique, unique_ptr from libcpp.string cimport string -from libcpp.vector cimport vector from libcpp.utility cimport move +from libcpp.vector cimport vector +import numpy as np import pandas as pd + import cudf -import numpy as np from cudf._lib.cpp.types cimport size_type import collections.abc as abc import errno -from io import BytesIO, StringIO import os - from enum import IntEnum - -from libcpp cimport bool +from io import BytesIO, StringIO from libc.stdint cimport int32_t +from libcpp cimport bool from cudf._lib.cpp.io.csv cimport ( - read_csv as cpp_read_csv, csv_reader_options, - write_csv as cpp_write_csv, csv_writer_options, + read_csv as cpp_read_csv, + write_csv as cpp_write_csv, ) - from cudf._lib.cpp.io.types cimport ( compression_type, data_sink, @@ -37,11 +35,11 @@ from cudf._lib.cpp.io.types cimport ( sink_info, source_info, table_metadata, - table_with_metadata + table_with_metadata, ) -from cudf._lib.io.utils cimport make_source_info, make_sink_info -from cudf._lib.table cimport Table, make_table_view from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.io.utils cimport make_sink_info, make_source_info +from cudf._lib.table cimport Table, make_table_view ctypedef int32_t underlying_type_t_compression diff --git a/python/cudf/cudf/_lib/datetime.pyx b/python/cudf/cudf/_lib/datetime.pyx index 09be55abe9d..8780f1c1dbf 100644 --- a/python/cudf/cudf/_lib/datetime.pyx +++ b/python/cudf/cudf/_lib/datetime.pyx @@ -1,13 +1,11 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +cimport cudf._lib.cpp.datetime as libcudf_datetime +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.column cimport Column - -cimport cudf._lib.cpp.datetime as libcudf_datetime - def add_months(Column col, Column months): # months must be int16 dtype diff --git a/python/cudf/cudf/_lib/filling.pyx b/python/cudf/cudf/_lib/filling.pyx index a3941c9479b..d9fdf72415c 100644 --- a/python/cudf/cudf/_lib/filling.pyx +++ b/python/cudf/cudf/_lib/filling.pyx @@ -6,13 +6,10 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.column cimport Column +cimport cudf._lib.cpp.filling as cpp_filling from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view @@ -20,8 +17,6 @@ from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar from cudf._lib.table cimport Table -cimport cudf._lib.cpp.filling as cpp_filling - def fill_in_place(Column destination, int begin, int end, DeviceScalar value): cdef mutable_column_view c_destination = destination.mutable_view() diff --git a/python/cudf/cudf/_lib/gpuarrow.pyx b/python/cudf/cudf/_lib/gpuarrow.pyx index a7da22637b9..0768517485e 100644 --- a/python/cudf/cudf/_lib/gpuarrow.pyx +++ b/python/cudf/cudf/_lib/gpuarrow.pyx @@ -4,22 +4,21 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from pyarrow._cuda cimport CudaBuffer from pyarrow.includes.libarrow_cuda cimport CCudaBufferReader + from cudf._lib.cpp.gpuarrow cimport CCudaMessageReader + from numba.cuda.cudadrv.devicearray import DeviceNDArray + from pyarrow.includes.common cimport GetResultValue from pyarrow.includes.libarrow cimport ( - CMessage, CBufferReader, - CMessageReader, CIpcReadOptions, - CRecordBatchStreamReader -) -from pyarrow.lib cimport ( - RecordBatchReader, - Buffer, - Schema, - pyarrow_wrap_schema + CMessage, + CMessageReader, + CRecordBatchStreamReader, ) +from pyarrow.lib cimport Buffer, RecordBatchReader, Schema, pyarrow_wrap_schema + import pyarrow as pa diff --git a/python/cudf/cudf/_lib/groupby.pyx b/python/cudf/cudf/_lib/groupby.pyx index 1a7f34d74b9..12e3f65a8a2 100644 --- a/python/cudf/cudf/_lib/groupby.pyx +++ b/python/cudf/cudf/_lib/groupby.pyx @@ -1,43 +1,44 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from collections import defaultdict + +import numpy as np from pandas.core.groupby.groupby import DataError + +import rmm + from cudf.utils.dtypes import ( is_categorical_dtype, - is_string_dtype, - is_list_dtype, + is_decimal_dtype, is_interval_dtype, + is_list_dtype, + is_string_dtype, is_struct_dtype, - is_decimal_dtype, ) -import numpy as np -import rmm - -from libcpp.pair cimport pair +from libcpp cimport bool from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair from libcpp.utility cimport move from libcpp.vector cimport vector -from libcpp cimport bool from cudf._lib.column cimport Column -from cudf._lib.table cimport Table from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.table cimport Table + from cudf._lib.scalar import as_device_scalar -from cudf._lib.aggregation cimport Aggregation, make_aggregation -from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.libcpp.functional cimport reference_wrapper +cimport cudf._lib.cpp.groupby as libcudf_groupby +cimport cudf._lib.cpp.types as libcudf_types +from cudf._lib.aggregation cimport Aggregation, make_aggregation from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.table.table cimport table, table_view +from cudf._lib.cpp.libcpp.functional cimport reference_wrapper from cudf._lib.cpp.replace cimport replace_policy -from cudf._lib.cpp.utilities.host_span cimport host_span +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.table.table cimport table, table_view from cudf._lib.cpp.types cimport size_type -cimport cudf._lib.cpp.types as libcudf_types -cimport cudf._lib.cpp.groupby as libcudf_groupby - +from cudf._lib.cpp.utilities.host_span cimport host_span # The sets below define the possible aggregations that can be performed on # different dtypes. These strings must be elements of the AggregationKind enum. diff --git a/python/cudf/cudf/_lib/hash.pyx b/python/cudf/cudf/_lib/hash.pyx index 196c88a8a20..198e7a748c9 100644 --- a/python/cudf/cudf/_lib/hash.pyx +++ b/python/cudf/cudf/_lib/hash.pyx @@ -2,24 +2,19 @@ from libc.stdint cimport uint32_t from libcpp cimport bool -from libcpp.pair cimport pair from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair from libcpp.utility cimport move from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.hash cimport hash as cpp_hash +from cudf._lib.cpp.partitioning cimport hash_partition as cpp_hash_partition from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.hash cimport ( - hash as cpp_hash -) -from cudf._lib.cpp.partitioning cimport ( - hash_partition as cpp_hash_partition, -) -cimport cudf._lib.cpp.types as libcudf_types +from cudf._lib.table cimport Table def hash_partition(Table source_table, object columns_to_hash, diff --git a/python/cudf/cudf/_lib/interop.pyx b/python/cudf/cudf/_lib/interop.pyx index 04971b58cd2..08ea58e4587 100644 --- a/python/cudf/cudf/_lib/interop.pyx +++ b/python/cudf/cudf/_lib/interop.pyx @@ -2,27 +2,25 @@ import cudf -from cudf._lib.table cimport Table -from libcpp.vector cimport vector -from libcpp.string cimport string +from cpython cimport pycapsule from libcpp cimport bool - -from libcpp.memory cimport unique_ptr, shared_ptr +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move +from libcpp.vector cimport vector +from pyarrow.lib cimport CTable, pyarrow_unwrap_table, pyarrow_wrap_table -from cpython cimport pycapsule - -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view -from pyarrow.lib cimport CTable, pyarrow_wrap_table, pyarrow_unwrap_table from cudf._lib.cpp.interop cimport ( - to_arrow as cpp_to_arrow, + DLManagedTensor, + column_metadata, from_arrow as cpp_from_arrow, from_dlpack as cpp_from_dlpack, + to_arrow as cpp_to_arrow, to_dlpack as cpp_to_dlpack, - column_metadata, - DLManagedTensor ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.table cimport Table def from_dlpack(dlpack_capsule): diff --git a/python/cudf/cudf/_lib/io/datasource.pxd b/python/cudf/cudf/_lib/io/datasource.pxd index 528a6c52edd..705a3600f68 100644 --- a/python/cudf/cudf/_lib/io/datasource.pxd +++ b/python/cudf/cudf/_lib/io/datasource.pxd @@ -1,8 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.io.types cimport datasource + cdef class Datasource: cdef datasource* get_datasource(self) nogil except * diff --git a/python/cudf/cudf/_lib/io/datasource.pyx b/python/cudf/cudf/_lib/io/datasource.pyx index b706847647b..ddfd9a3540a 100644 --- a/python/cudf/cudf/_lib/io/datasource.pyx +++ b/python/cudf/cudf/_lib/io/datasource.pyx @@ -1,8 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr + from cudf._lib.cpp.io.types cimport datasource + cdef class Datasource: cdef datasource* get_datasource(self) nogil except *: with gil: diff --git a/python/cudf/cudf/_lib/io/utils.pxd b/python/cudf/cudf/_lib/io/utils.pxd index 589d48db812..82ad9d67f78 100644 --- a/python/cudf/cudf/_lib/io/utils.pxd +++ b/python/cudf/cudf/_lib/io/utils.pxd @@ -1,16 +1,17 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2021, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.vector cimport vector from cudf._lib.cpp.io.types cimport ( - source_info, - sink_info, + column_name_info, data_sink, - column_name_info + sink_info, + source_info, ) from cudf._lib.table cimport Table + cdef source_info make_source_info(list src) except* cdef sink_info make_sink_info(src, unique_ptr[data_sink] & data) except* cdef update_struct_field_names( diff --git a/python/cudf/cudf/_lib/io/utils.pyx b/python/cudf/cudf/_lib/io/utils.pyx index 44951c59525..72ab64f6249 100644 --- a/python/cudf/cudf/_lib/io/utils.pyx +++ b/python/cudf/cudf/_lib/io/utils.pyx @@ -1,30 +1,34 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2021, NVIDIA CORPORATION. from cpython.buffer cimport PyBUF_READ from cpython.memoryview cimport PyMemoryView_FromMemory from libcpp.map cimport map from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move -from libcpp.vector cimport vector from libcpp.pair cimport pair from libcpp.string cimport string +from libcpp.utility cimport move +from libcpp.vector cimport vector + from cudf._lib.column cimport Column -from cudf._lib.cpp.io.types cimport source_info, io_type, host_buffer from cudf._lib.cpp.io.types cimport ( - sink_info, + column_name_info, data_sink, datasource, - column_name_info, + host_buffer, + io_type, + sink_info, + source_info, ) from cudf._lib.io.datasource cimport Datasource -from cudf.utils.dtypes import is_struct_dtype - import codecs import errno import io import os + import cudf +from cudf.utils.dtypes import is_struct_dtype + # Converts the Python source input to libcudf++ IO source_info # with the appropriate type and source values diff --git a/python/cudf/cudf/_lib/join.pyx b/python/cudf/cudf/_lib/join.pyx index 193c2ca9d67..186f8d32aeb 100644 --- a/python/cudf/cudf/_lib/join.pyx +++ b/python/cudf/cudf/_lib/join.pyx @@ -1,24 +1,22 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -import cudf - from itertools import chain -from libcpp.memory cimport unique_ptr, make_unique +import cudf + +from libcpp cimport bool +from libcpp.memory cimport make_unique, unique_ptr +from libcpp.pair cimport pair from libcpp.utility cimport move from libcpp.vector cimport vector -from libcpp.pair cimport pair -from libcpp cimport bool +cimport cudf._lib.cpp.join as cpp_join from cudf._lib.column cimport Column -from cudf._lib.table cimport Table, columns_from_ptr - from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.types cimport size_type, data_type, type_id from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.join as cpp_join - +from cudf._lib.cpp.types cimport data_type, size_type, type_id +from cudf._lib.table cimport Table, columns_from_ptr # The functions below return the *gathermaps* that represent # the join result when joining on the keys `lhs` and `rhs`. diff --git a/python/cudf/cudf/_lib/json.pyx b/python/cudf/cudf/_lib/json.pyx index 48538c50f88..4a15edf8a19 100644 --- a/python/cudf/cudf/_lib/json.pyx +++ b/python/cudf/cudf/_lib/json.pyx @@ -3,24 +3,25 @@ # cython: boundscheck = False -import cudf import collections.abc as abc import io import os +import cudf + from libcpp cimport bool from libcpp.string cimport string -from libcpp.vector cimport vector from libcpp.utility cimport move +from libcpp.vector cimport vector +cimport cudf._lib.cpp.io.types as cudf_io_types from cudf._lib.cpp.io.json cimport ( + json_reader_options, read_json as libcudf_read_json, - json_reader_options ) from cudf._lib.cpp.types cimport size_type from cudf._lib.io.utils cimport make_source_info from cudf._lib.table cimport Table -cimport cudf._lib.cpp.io.types as cudf_io_types cpdef read_json(object filepaths_or_buffers, diff --git a/python/cudf/cudf/_lib/labeling.pyx b/python/cudf/cudf/_lib/labeling.pyx index 1b553024347..088942064a8 100644 --- a/python/cudf/cudf/_lib/labeling.pyx +++ b/python/cudf/cudf/_lib/labeling.pyx @@ -1,20 +1,21 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -import numpy as np from enum import IntEnum +import numpy as np + from libc.stdint cimport uint32_t from libcpp cimport bool as cbool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from cudf._lib.column cimport Column + from cudf._lib.replace import replace_nulls -from cudf._lib.cpp.labeling cimport inclusive -from cudf._lib.cpp.labeling cimport label_bins as cpp_label_bins from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.labeling cimport inclusive, label_bins as cpp_label_bins # Note that the parameter input shadows a Python built-in in the local scope, diff --git a/python/cudf/cudf/_lib/lists.pyx b/python/cudf/cudf/_lib/lists.pyx index 9fd7d7611ae..8ada3376fdb 100644 --- a/python/cudf/cudf/_lib/lists.pyx +++ b/python/cudf/cudf/_lib/lists.pyx @@ -1,55 +1,47 @@ # Copyright (c) 2021, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.memory cimport unique_ptr, shared_ptr, make_shared +from libcpp.memory cimport make_shared, shared_ptr, unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.lists.count_elements cimport ( - count_elements as cpp_count_elements +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.lists.combine cimport ( + concatenate_list_elements as cpp_concatenate_list_elements, + concatenate_null_policy, + concatenate_rows as cpp_concatenate_rows, ) -from cudf._lib.cpp.lists.explode cimport ( - explode_outer as cpp_explode_outer +from cudf._lib.cpp.lists.count_elements cimport ( + count_elements as cpp_count_elements, ) from cudf._lib.cpp.lists.drop_list_duplicates cimport ( - drop_list_duplicates as cpp_drop_list_duplicates + drop_list_duplicates as cpp_drop_list_duplicates, ) -from cudf._lib.cpp.lists.sorting cimport ( - sort_lists as cpp_sort_lists -) -from cudf._lib.cpp.lists.combine cimport ( - concatenate_rows as cpp_concatenate_rows, - concatenate_null_policy, - concatenate_list_elements as cpp_concatenate_list_elements -) - +from cudf._lib.cpp.lists.explode cimport explode_outer as cpp_explode_outer from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.column.column cimport column - -from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.cpp.lists.sorting cimport sort_lists as cpp_sort_lists from cudf._lib.cpp.scalar.scalar cimport scalar - from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport ( - size_type, + nan_equality, null_equality, + null_order, null_policy, order, - null_order, - nan_equality + size_type, ) - -from cudf._lib.column cimport Column +from cudf._lib.scalar cimport DeviceScalar from cudf._lib.table cimport Table - from cudf._lib.types cimport ( - underlying_type_t_null_order, underlying_type_t_order + underlying_type_t_null_order, + underlying_type_t_order, ) + from cudf.core.dtypes import ListDtype from cudf._lib.cpp.lists.contains cimport contains - from cudf._lib.cpp.lists.extract cimport extract_list_element diff --git a/python/cudf/cudf/_lib/merge.pyx b/python/cudf/cudf/_lib/merge.pyx index 81d5807906a..cc2d405c207 100644 --- a/python/cudf/cudf/_lib/merge.pyx +++ b/python/cudf/cudf/_lib/merge.pyx @@ -1,17 +1,16 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from libcpp cimport bool +from libcpp.vector cimport vector +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - +from cudf._lib.cpp.merge cimport merge as cpp_merge from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.merge cimport merge as cpp_merge -cimport cudf._lib.cpp.types as libcudf_types +from cudf._lib.table cimport Table def merge_sorted( diff --git a/python/cudf/cudf/_lib/null_mask.pyx b/python/cudf/cudf/_lib/null_mask.pyx index 81ddbaa48ac..b6e26fe594f 100644 --- a/python/cudf/cudf/_lib/null_mask.pyx +++ b/python/cudf/cudf/_lib/null_mask.pyx @@ -2,22 +2,23 @@ from enum import Enum -from libcpp.memory cimport unique_ptr, make_unique +from libcpp.memory cimport make_unique, unique_ptr from libcpp.utility cimport move -from rmm._lib.device_buffer cimport device_buffer, DeviceBuffer +from rmm._lib.device_buffer cimport DeviceBuffer, device_buffer from cudf._lib.column cimport Column + import cudf._lib as libcudfxx -from cudf._lib.cpp.types cimport mask_state, size_type from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.null_mask cimport ( + bitmask_allocation_size_bytes as cpp_bitmask_allocation_size_bytes, copy_bitmask as cpp_copy_bitmask, create_null_mask as cpp_create_null_mask, - bitmask_allocation_size_bytes as cpp_bitmask_allocation_size_bytes, - underlying_type_t_mask_state + underlying_type_t_mask_state, ) +from cudf._lib.cpp.types cimport mask_state, size_type from cudf.core.buffer import Buffer diff --git a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx index a1e59585df2..f1e15570e9f 100644 --- a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx +++ b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx @@ -4,13 +4,13 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.edit_distance cimport ( edit_distance as cpp_edit_distance, - edit_distance_matrix as cpp_edit_distance_matrix + edit_distance_matrix as cpp_edit_distance_matrix, ) -from cudf._lib.column cimport Column def edit_distance(Column strings, Column targets): diff --git a/python/cudf/cudf/_lib/nvtext/generate_ngrams.pyx b/python/cudf/cudf/_lib/nvtext/generate_ngrams.pyx index 48d67110621..5fcec570dcb 100644 --- a/python/cudf/cudf/_lib/nvtext/generate_ngrams.pyx +++ b/python/cudf/cudf/_lib/nvtext/generate_ngrams.pyx @@ -3,15 +3,15 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.generate_ngrams cimport ( + generate_character_ngrams as cpp_generate_character_ngrams, generate_ngrams as cpp_generate_ngrams, - generate_character_ngrams as cpp_generate_character_ngrams ) -from cudf._lib.column cimport Column +from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/nvtext/ngrams_tokenize.pyx b/python/cudf/cudf/_lib/nvtext/ngrams_tokenize.pyx index cf0a4a0f55a..1e9e0e39ff1 100644 --- a/python/cudf/cudf/_lib/nvtext/ngrams_tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/ngrams_tokenize.pyx @@ -3,14 +3,14 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.ngrams_tokenize cimport ( - ngrams_tokenize as cpp_ngrams_tokenize + ngrams_tokenize as cpp_ngrams_tokenize, ) -from cudf._lib.column cimport Column +from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/nvtext/normalize.pyx b/python/cudf/cudf/_lib/nvtext/normalize.pyx index 88f0f0a957a..e475f0cd996 100644 --- a/python/cudf/cudf/_lib/nvtext/normalize.pyx +++ b/python/cudf/cudf/_lib/nvtext/normalize.pyx @@ -4,13 +4,13 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.normalize cimport ( normalize_characters as cpp_normalize_characters, - normalize_spaces as cpp_normalize_spaces + normalize_spaces as cpp_normalize_spaces, ) -from cudf._lib.column cimport Column def normalize_spaces(Column strings): diff --git a/python/cudf/cudf/_lib/nvtext/replace.pyx b/python/cudf/cudf/_lib/nvtext/replace.pyx index cb552161b52..b4f37ac3ec7 100644 --- a/python/cudf/cudf/_lib/nvtext/replace.pyx +++ b/python/cudf/cudf/_lib/nvtext/replace.pyx @@ -3,15 +3,15 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.types cimport size_type +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.replace cimport ( - replace_tokens as cpp_replace_tokens, filter_tokens as cpp_filter_tokens, + replace_tokens as cpp_replace_tokens, ) -from cudf._lib.column cimport Column +from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/nvtext/stemmer.pyx b/python/cudf/cudf/_lib/nvtext/stemmer.pyx index 1aca32a5667..89d4b07b7ad 100644 --- a/python/cudf/cudf/_lib/nvtext/stemmer.pyx +++ b/python/cudf/cudf/_lib/nvtext/stemmer.pyx @@ -2,19 +2,19 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + from enum import IntEnum +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column - from cudf._lib.cpp.nvtext.stemmer cimport ( - porter_stemmer_measure as cpp_porter_stemmer_measure, is_letter as cpp_is_letter, - letter_type as letter_type + letter_type as letter_type, + porter_stemmer_measure as cpp_porter_stemmer_measure, + underlying_type_t_letter_type, ) -from cudf._lib.cpp.nvtext.stemmer cimport underlying_type_t_letter_type +from cudf._lib.cpp.types cimport size_type class LetterType(IntEnum): diff --git a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx index 3cf3cbe1ef2..49f24436b88 100644 --- a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx @@ -1,22 +1,21 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport uint32_t, uintptr_t from libcpp cimport bool from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move from libcpp.string cimport string -from libc.stdint cimport uint32_t -from libc.stdint cimport uintptr_t +from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.nvtext.subword_tokenize cimport( - subword_tokenize as cpp_subword_tokenize, +from cudf._lib.cpp.nvtext.subword_tokenize cimport ( hashed_vocabulary as cpp_hashed_vocabulary, load_vocabulary_file as cpp_load_vocabulary_file, - tokenizer_result as cpp_tokenizer_result, move as tr_move, + subword_tokenize as cpp_subword_tokenize, + tokenizer_result as cpp_tokenizer_result, ) -from cudf._lib.column cimport Column cdef class Hashed_Vocabulary: diff --git a/python/cudf/cudf/_lib/nvtext/tokenize.pyx b/python/cudf/cudf/_lib/nvtext/tokenize.pyx index c7f5c2a12c4..5fc852c2ab0 100644 --- a/python/cudf/cudf/_lib/nvtext/tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/tokenize.pyx @@ -3,17 +3,17 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.tokenize cimport ( - tokenize as cpp_tokenize, - detokenize as cpp_detokenize, + character_tokenize as cpp_character_tokenize, count_tokens as cpp_count_tokens, - character_tokenize as cpp_character_tokenize + detokenize as cpp_detokenize, + tokenize as cpp_tokenize, ) -from cudf._lib.column cimport Column +from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/orc.pyx b/python/cudf/cudf/_lib/orc.pyx index 944300cc167..2470c15f541 100644 --- a/python/cudf/cudf/_lib/orc.pyx +++ b/python/cudf/cudf/_lib/orc.pyx @@ -3,27 +3,27 @@ import cudf from libcpp cimport bool, int -from libcpp.memory cimport unique_ptr, make_unique +from libcpp.memory cimport make_unique, unique_ptr from libcpp.string cimport string -from libcpp.vector cimport vector from libcpp.utility cimport move +from libcpp.vector cimport vector + from cudf._lib.cpp.column.column cimport column from cudf.utils.dtypes import is_struct_dtype from cudf._lib.column cimport Column - -from cudf._lib.cpp.io.orc_metadata cimport ( - raw_orc_statistics, - read_raw_orc_statistics as libcudf_read_raw_orc_statistics -) from cudf._lib.cpp.io.orc cimport ( + chunked_orc_writer_options, + orc_chunked_writer, orc_reader_options, - read_orc as libcudf_read_orc, orc_writer_options, + read_orc as libcudf_read_orc, write_orc as libcudf_write_orc, - chunked_orc_writer_options, - orc_chunked_writer +) +from cudf._lib.cpp.io.orc_metadata cimport ( + raw_orc_statistics, + read_raw_orc_statistics as libcudf_read_raw_orc_statistics, ) from cudf._lib.cpp.io.types cimport ( column_name_info, @@ -32,31 +32,27 @@ from cudf._lib.cpp.io.types cimport ( sink_info, source_info, table_metadata, + table_metadata_with_nullability, table_with_metadata, - table_metadata_with_nullability ) - from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.types cimport ( - data_type, type_id, size_type -) - +from cudf._lib.cpp.types cimport data_type, size_type, type_id from cudf._lib.io.utils cimport ( - make_source_info, make_sink_info, + make_source_info, update_struct_field_names, ) from cudf._lib.table cimport Table + from cudf._lib.types import np_to_cudf_types + from cudf._lib.types cimport underlying_type_t_type_id + import numpy as np from cudf._lib.utils cimport get_column_names -from cudf._lib.utils import ( - _index_level_name, - generate_pandas_metadata, -) +from cudf._lib.utils import _index_level_name, generate_pandas_metadata cpdef read_raw_orc_statistics(filepath_or_buffer): diff --git a/python/cudf/cudf/_lib/parquet.pyx b/python/cudf/cudf/_lib/parquet.pyx index 3208b175c6e..52f3aada00b 100644 --- a/python/cudf/cudf/_lib/parquet.pyx +++ b/python/cudf/cudf/_lib/parquet.pyx @@ -2,71 +2,68 @@ # cython: boundscheck = False -import cudf import errno import os -import pyarrow as pa from collections import OrderedDict +import pyarrow as pa + +import cudf + try: import ujson as json except ImportError: import json -from cython.operator import dereference import numpy as np +from cython.operator import dereference from cudf.utils.dtypes import ( - np_to_pa_dtype, is_categorical_dtype, + is_decimal_dtype, is_list_dtype, is_struct_dtype, - is_decimal_dtype, + np_to_pa_dtype, ) from cudf._lib.utils cimport get_column_names -from cudf._lib.utils import ( - _index_level_name, - generate_pandas_metadata, -) -from libc.stdlib cimport free +from cudf._lib.utils import _index_level_name, generate_pandas_metadata + from libc.stdint cimport uint8_t -from libcpp.memory cimport unique_ptr, make_unique -from libcpp.string cimport string +from libc.stdlib cimport free +from libcpp cimport bool from libcpp.map cimport map -from libcpp.vector cimport vector +from libcpp.memory cimport make_unique, unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from libcpp cimport bool - +from libcpp.vector cimport vector -from cudf._lib.cpp.types cimport data_type, size_type -from cudf._lib.table cimport Table -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport ( - table_view -) +cimport cudf._lib.cpp.io.types as cudf_io_types +cimport cudf._lib.cpp.types as cudf_types +from cudf._lib.column cimport Column from cudf._lib.cpp.io.parquet cimport ( - read_parquet as parquet_reader, - parquet_reader_options, - table_input_metadata, - column_in_metadata, - parquet_writer_options, - write_parquet as parquet_writer, - parquet_chunked_writer as cpp_parquet_chunked_writer, chunked_parquet_writer_options, chunked_parquet_writer_options_builder, + column_in_metadata, merge_rowgroup_metadata as parquet_merge_metadata, + parquet_chunked_writer as cpp_parquet_chunked_writer, + parquet_reader_options, + parquet_writer_options, + read_parquet as parquet_reader, + table_input_metadata, + write_parquet as parquet_writer, ) -from cudf._lib.column cimport Column +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport data_type, size_type from cudf._lib.io.utils cimport ( - make_source_info, make_sink_info, + make_source_info, update_struct_field_names, ) +from cudf._lib.table cimport Table -cimport cudf._lib.cpp.types as cudf_types -cimport cudf._lib.cpp.io.types as cudf_io_types cdef class BufferArrayFromVector: cdef Py_ssize_t length diff --git a/python/cudf/cudf/_lib/partitioning.pyx b/python/cudf/cudf/_lib/partitioning.pyx index b33ccb24039..865138bec84 100644 --- a/python/cudf/cudf/_lib/partitioning.pyx +++ b/python/cudf/cudf/_lib/partitioning.pyx @@ -1,22 +1,20 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.pair cimport pair from libcpp.memory cimport unique_ptr -from libcpp.vector cimport vector +from libcpp.pair cimport pair from libcpp.utility cimport move +from libcpp.vector cimport vector from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.partitioning cimport partition as cpp_partition from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.table cimport Table -from cudf._lib.cpp.partitioning cimport ( - partition as cpp_partition, -) from cudf._lib.stream_compaction import distinct_count as cpp_distinct_count + cimport cudf._lib.cpp.types as libcudf_types diff --git a/python/cudf/cudf/_lib/quantiles.pyx b/python/cudf/cudf/_lib/quantiles.pyx index 0c1338103be..45a4ff7c92c 100644 --- a/python/cudf/cudf/_lib/quantiles.pyx +++ b/python/cudf/cudf/_lib/quantiles.pyx @@ -1,34 +1,36 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from libcpp.vector cimport vector from cudf._lib.column cimport Column from cudf._lib.scalar cimport DeviceScalar from cudf._lib.table cimport Table from cudf._lib.types cimport ( - underlying_type_t_order, + underlying_type_t_interpolation, underlying_type_t_null_order, + underlying_type_t_order, underlying_type_t_sorted, - underlying_type_t_interpolation, ) + from cudf._lib.types import Interpolation + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.quantiles cimport ( + quantile as cpp_quantile, + quantiles as cpp_quantiles, +) from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport ( interpolation, null_order, order, - sorted, order_info, -) -from cudf._lib.cpp.quantiles cimport ( - quantile as cpp_quantile, - quantiles as cpp_quantiles, + sorted, ) diff --git a/python/cudf/cudf/_lib/reduce.pyx b/python/cudf/cudf/_lib/reduce.pyx index e5723331f3c..49ebb0a2528 100644 --- a/python/cudf/cudf/_lib/reduce.pyx +++ b/python/cudf/cudf/_lib/reduce.pyx @@ -1,20 +1,25 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. import cudf -from cudf.utils.dtypes import is_decimal_dtype from cudf.core.dtypes import Decimal64Dtype -from cudf._lib.cpp.reduce cimport cpp_reduce, cpp_scan, scan_type, cpp_minmax +from cudf.utils.dtypes import is_decimal_dtype + +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.reduce cimport cpp_minmax, cpp_reduce, cpp_scan, scan_type from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.types cimport data_type, type_id -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.column.column cimport column from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.column cimport Column + from cudf._lib.types import np_to_cudf_types -from cudf._lib.types cimport underlying_type_t_type_id, dtype_to_data_type -from cudf._lib.aggregation cimport make_aggregation, Aggregation + from libcpp.memory cimport unique_ptr from libcpp.utility cimport move, pair + +from cudf._lib.aggregation cimport Aggregation, make_aggregation +from cudf._lib.types cimport dtype_to_data_type, underlying_type_t_type_id + import numpy as np cimport cudf._lib.cpp.types as libcudf_types diff --git a/python/cudf/cudf/_lib/replace.pyx b/python/cudf/cudf/_lib/replace.pyx index cdedd3ac022..2ae0835566b 100644 --- a/python/cudf/cudf/_lib/replace.pyx +++ b/python/cudf/cudf/_lib/replace.pyx @@ -6,22 +6,20 @@ from libcpp.utility cimport move from cudf.utils.dtypes import is_scalar from cudf._lib.column cimport Column + from cudf._lib.scalar import as_device_scalar -from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.replace cimport ( - replace_policy as cpp_replace_policy, + clamp as cpp_clamp, find_and_replace_all as cpp_find_and_replace_all, + normalize_nans_and_zeros as cpp_normalize_nans_and_zeros, replace_nulls as cpp_replace_nulls, - clamp as cpp_clamp, - normalize_nans_and_zeros as cpp_normalize_nans_and_zeros + replace_policy as cpp_replace_policy, ) +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.scalar cimport DeviceScalar def replace(Column input_col, Column values_to_replace, diff --git a/python/cudf/cudf/_lib/reshape.pyx b/python/cudf/cudf/_lib/reshape.pyx index cebe48eb697..fbed410de86 100644 --- a/python/cudf/cudf/_lib/reshape.pyx +++ b/python/cudf/cudf/_lib/reshape.pyx @@ -2,18 +2,17 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.column cimport Column -from cudf._lib.table cimport Table -from cudf._lib.cpp.types cimport size_type +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view - from cudf._lib.cpp.reshape cimport ( interleave_columns as cpp_interleave_columns, - tile as cpp_tile + tile as cpp_tile, ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport size_type +from cudf._lib.table cimport Table def interleave_columns(Table source_table): diff --git a/python/cudf/cudf/_lib/rolling.pyx b/python/cudf/cudf/_lib/rolling.pyx index 6fe661a25a5..87c2fa6178f 100644 --- a/python/cudf/cudf/_lib/rolling.pyx +++ b/python/cudf/cudf/_lib/rolling.pyx @@ -1,21 +1,20 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from __future__ import print_function -import cudf + import pandas as pd +import cudf + from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.column cimport Column from cudf._lib.aggregation cimport RollingAggregation, make_rolling_aggregation - -from cudf._lib.cpp.types cimport size_type +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.rolling cimport ( - rolling_window as cpp_rolling_window -) +from cudf._lib.cpp.rolling cimport rolling_window as cpp_rolling_window +from cudf._lib.cpp.types cimport size_type def rolling(Column source_column, Column pre_column_window, diff --git a/python/cudf/cudf/_lib/round.pyx b/python/cudf/cudf/_lib/round.pyx index 823da40f45b..c5c565561a9 100644 --- a/python/cudf/cudf/_lib/round.pyx +++ b/python/cudf/cudf/_lib/round.pyx @@ -4,12 +4,11 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from cudf._lib.column cimport Column - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.round cimport ( + round as cpp_round, rounding_method as cpp_rounding_method, - round as cpp_round ) diff --git a/python/cudf/cudf/_lib/scalar.pyx b/python/cudf/cudf/_lib/scalar.pyx index 9e50f42d625..7cc67c54bd1 100644 --- a/python/cudf/cudf/_lib/scalar.pyx +++ b/python/cudf/cudf/_lib/scalar.pyx @@ -1,8 +1,10 @@ # Copyright (c) 2020, NVIDIA CORPORATION. import decimal + import numpy as np import pandas as pd import pyarrow as pa + from libc.stdint cimport ( int8_t, int16_t, @@ -13,51 +15,55 @@ from libc.stdint cimport ( uint32_t, uint64_t, ) +from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from libcpp cimport bool import cudf -from cudf.core.dtypes import ListDtype, StructDtype from cudf._lib.types import ( cudf_to_np_types, - duration_unit_map + datetime_unit_map, + duration_unit_map, ) -from cudf._lib.types import datetime_unit_map -from cudf._lib.types cimport underlying_type_t_type_id, dtype_from_column_view +from cudf.core.dtypes import ListDtype, StructDtype from cudf._lib.column cimport Column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.table cimport Table -from cudf._lib.interop import to_arrow, from_arrow +from cudf._lib.types cimport dtype_from_column_view, underlying_type_t_type_id + +from cudf._lib.interop import from_arrow, to_arrow -from cudf._lib.cpp.wrappers.timestamps cimport ( - timestamp_s, - timestamp_ms, - timestamp_us, - timestamp_ns -) -from cudf._lib.cpp.wrappers.durations cimport( - duration_s, - duration_ms, - duration_us, - duration_ns -) -from cudf._lib.cpp.wrappers.decimals cimport decimal64, scale_type from cudf._lib.cpp.scalar.scalar cimport ( - scalar, - numeric_scalar, - timestamp_scalar, duration_scalar, - string_scalar, fixed_point_scalar, list_scalar, - struct_scalar + numeric_scalar, + scalar, + string_scalar, + struct_scalar, + timestamp_scalar, ) +from cudf._lib.cpp.wrappers.decimals cimport decimal64, scale_type +from cudf._lib.cpp.wrappers.durations cimport ( + duration_ms, + duration_ns, + duration_s, + duration_us, +) +from cudf._lib.cpp.wrappers.timestamps cimport ( + timestamp_ms, + timestamp_ns, + timestamp_s, + timestamp_us, +) + from cudf.utils.dtypes import _decimal_to_int64, is_list_dtype, is_struct_dtype + cimport cudf._lib.cpp.types as libcudf_types + cdef class DeviceScalar: def __init__(self, value, dtype): diff --git a/python/cudf/cudf/_lib/search.pyx b/python/cudf/cudf/_lib/search.pyx index 402e3456821..33471028d66 100644 --- a/python/cudf/cudf/_lib/search.pyx +++ b/python/cudf/cudf/_lib/search.pyx @@ -1,17 +1,16 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from libcpp.vector cimport vector +cimport cudf._lib.cpp.search as cpp_search +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table_view cimport table_view -cimport cudf._lib.cpp.types as libcudf_types -cimport cudf._lib.cpp.search as cpp_search +from cudf._lib.table cimport Table def search_sorted( diff --git a/python/cudf/cudf/_lib/sort.pxd b/python/cudf/cudf/_lib/sort.pxd index 6a06c132daa..d7488889555 100644 --- a/python/cudf/cudf/_lib/sort.pxd +++ b/python/cudf/cudf/_lib/sort.pxd @@ -1,2 +1,3 @@ from libc.stdint cimport int32_t + ctypedef int32_t underlying_type_t_rank_method diff --git a/python/cudf/cudf/_lib/sort.pyx b/python/cudf/cudf/_lib/sort.pyx index a20ab4c1bf4..1d15052e41a 100644 --- a/python/cudf/cudf/_lib/sort.pyx +++ b/python/cudf/cudf/_lib/sort.pyx @@ -4,23 +4,26 @@ import pandas as pd from libcpp cimport bool from libcpp.memory cimport unique_ptr -from libcpp.vector cimport vector from libcpp.utility cimport move +from libcpp.vector cimport vector + from enum import IntEnum from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.search cimport lower_bound, upper_bound -from cudf._lib.cpp.sorting cimport( - rank, rank_method, sorted_order, is_sorted as cpp_is_sorted +from cudf._lib.cpp.sorting cimport ( + is_sorted as cpp_is_sorted, + rank, + rank_method, + sorted_order, ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport null_order, null_policy, order from cudf._lib.sort cimport underlying_type_t_rank_method -from cudf._lib.cpp.types cimport order, null_order, null_policy +from cudf._lib.table cimport Table def is_sorted( diff --git a/python/cudf/cudf/_lib/stream_compaction.pyx b/python/cudf/cudf/_lib/stream_compaction.pyx index cabbdf89b4e..a7326efcc03 100644 --- a/python/cudf/cudf/_lib/stream_compaction.pyx +++ b/python/cudf/cudf/_lib/stream_compaction.pyx @@ -2,27 +2,29 @@ import pandas as pd +from libcpp cimport bool from libcpp.memory cimport unique_ptr -from libcpp.vector cimport vector from libcpp.utility cimport move -from libcpp cimport bool +from libcpp.vector cimport vector from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - -from cudf._lib.cpp.types cimport ( - size_type, null_policy, nan_policy, null_equality -) -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.stream_compaction cimport ( - duplicate_keep_option, - drop_nulls as cpp_drop_nulls, apply_boolean_mask as cpp_apply_boolean_mask, + distinct_count as cpp_distinct_count, drop_duplicates as cpp_drop_duplicates, - distinct_count as cpp_distinct_count + drop_nulls as cpp_drop_nulls, + duplicate_keep_option, ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport ( + nan_policy, + null_equality, + null_policy, + size_type, +) +from cudf._lib.table cimport Table def drop_nulls(Table source_table, how="any", keys=None, thresh=None): diff --git a/python/cudf/cudf/_lib/string_casting.pyx b/python/cudf/cudf/_lib/string_casting.pyx index 772a4d60ade..8f65cc9fee5 100644 --- a/python/cudf/cudf/_lib/string_casting.pyx +++ b/python/cudf/cudf/_lib/string_casting.pyx @@ -3,57 +3,58 @@ import numpy as np from cudf._lib.column cimport Column + from cudf._lib.scalar import as_device_scalar + from cudf._lib.scalar cimport DeviceScalar + from cudf._lib.types import np_to_cudf_types + from cudf._lib.types cimport underlying_type_t_type_id from cudf.core.column.column import as_column +from libcpp.memory cimport unique_ptr +from libcpp.string cimport string +from libcpp.utility cimport move + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.convert.convert_booleans cimport ( + from_booleans as cpp_from_booleans, to_booleans as cpp_to_booleans, - from_booleans as cpp_from_booleans ) from cudf._lib.cpp.strings.convert.convert_datetime cimport ( - to_timestamps as cpp_to_timestamps, from_timestamps as cpp_from_timestamps, - is_timestamp as cpp_is_timestamp + is_timestamp as cpp_is_timestamp, + to_timestamps as cpp_to_timestamps, +) +from cudf._lib.cpp.strings.convert.convert_durations cimport ( + from_durations as cpp_from_durations, + to_durations as cpp_to_durations, ) from cudf._lib.cpp.strings.convert.convert_floats cimport ( + from_floats as cpp_from_floats, to_floats as cpp_to_floats, - from_floats as cpp_from_floats ) from cudf._lib.cpp.strings.convert.convert_integers cimport ( - to_integers as cpp_to_integers, from_integers as cpp_from_integers, hex_to_integers as cpp_hex_to_integers, + integers_to_hex as cpp_integers_to_hex, is_hex as cpp_is_hex, - integers_to_hex as cpp_integers_to_hex + to_integers as cpp_to_integers, ) from cudf._lib.cpp.strings.convert.convert_ipv4 cimport ( - ipv4_to_integers as cpp_ipv4_to_integers, integers_to_ipv4 as cpp_integers_to_ipv4, - is_ipv4 as cpp_is_ipv4 + ipv4_to_integers as cpp_ipv4_to_integers, + is_ipv4 as cpp_is_ipv4, ) from cudf._lib.cpp.strings.convert.convert_urls cimport ( + url_decode as cpp_url_decode, url_encode as cpp_url_encode, - url_decode as cpp_url_decode -) -from cudf._lib.cpp.strings.convert.convert_durations cimport ( - to_durations as cpp_to_durations, - from_durations as cpp_from_durations -) -from cudf._lib.cpp.types cimport ( - type_id, - data_type, ) - -from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move -from libcpp.string cimport string +from cudf._lib.cpp.types cimport data_type, type_id def floating_to_string(Column input_col): diff --git a/python/cudf/cudf/_lib/strings/attributes.pyx b/python/cudf/cudf/_lib/strings/attributes.pyx index 3e0bacda546..8720fad7455 100644 --- a/python/cudf/cudf/_lib/strings/attributes.pyx +++ b/python/cudf/cudf/_lib/strings/attributes.pyx @@ -3,14 +3,14 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.attributes cimport ( - count_characters as cpp_count_characters, code_points as cpp_code_points, - count_bytes as cpp_count_bytes + count_bytes as cpp_count_bytes, + count_characters as cpp_count_characters, ) -from cudf._lib.column cimport Column def count_characters(Column source_strings): diff --git a/python/cudf/cudf/_lib/strings/capitalize.pyx b/python/cudf/cudf/_lib/strings/capitalize.pyx index 8316d42ee15..bb1bf25ef7b 100644 --- a/python/cudf/cudf/_lib/strings/capitalize.pyx +++ b/python/cudf/cudf/_lib/strings/capitalize.pyx @@ -3,13 +3,13 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.capitalize cimport ( capitalize as cpp_capitalize, title as cpp_title, ) -from cudf._lib.column cimport Column def capitalize(Column source_strings): diff --git a/python/cudf/cudf/_lib/strings/case.pyx b/python/cudf/cudf/_lib/strings/case.pyx index 6f114519374..13679f3fb02 100644 --- a/python/cudf/cudf/_lib/strings/case.pyx +++ b/python/cudf/cudf/_lib/strings/case.pyx @@ -3,14 +3,14 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.case cimport ( swapcase as cpp_swapcase, to_lower as cpp_to_lower, - to_upper as cpp_to_upper + to_upper as cpp_to_upper, ) -from cudf._lib.column cimport Column def to_upper(Column source_strings): diff --git a/python/cudf/cudf/_lib/strings/char_types.pyx b/python/cudf/cudf/_lib/strings/char_types.pyx index 1890e98f956..3ef9db2345d 100644 --- a/python/cudf/cudf/_lib/strings/char_types.pyx +++ b/python/cudf/cudf/_lib/strings/char_types.pyx @@ -4,17 +4,16 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.char_types cimport ( all_characters_of_type as cpp_all_characters_of_type, filter_characters_of_type as cpp_filter_characters_of_type, string_character_types as string_character_types, ) +from cudf._lib.scalar cimport DeviceScalar def filter_alphanum(Column source_strings, object py_repl, bool keep=True): diff --git a/python/cudf/cudf/_lib/strings/combine.pyx b/python/cudf/cudf/_lib/strings/combine.pyx index 3d20e5f15b7..e165c76e98d 100644 --- a/python/cudf/cudf/_lib/strings/combine.pyx +++ b/python/cudf/cudf/_lib/strings/combine.pyx @@ -1,25 +1,24 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type + from cudf._lib.column cimport Column -from libcpp.memory cimport unique_ptr from cudf._lib.cpp.column.column cimport column -from cudf._lib.scalar cimport DeviceScalar -from libcpp.string cimport string -from cudf._lib.table cimport Table - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.combine cimport ( concatenate as cpp_concatenate, - join_strings as cpp_join_strings, join_list_elements as cpp_join_list_elements, + join_strings as cpp_join_strings, + output_if_empty_list as output_if_empty_list, separator_on_nulls as separator_on_nulls, - output_if_empty_list as output_if_empty_list ) +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.table cimport Table def concatenate(Table source_strings, diff --git a/python/cudf/cudf/_lib/strings/contains.pyx b/python/cudf/cudf/_lib/strings/contains.pyx index 256803c9479..1f622378280 100644 --- a/python/cudf/cudf/_lib/strings/contains.pyx +++ b/python/cudf/cudf/_lib/strings/contains.pyx @@ -1,18 +1,18 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move + from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.contains cimport ( contains_re as cpp_contains_re, count_re as cpp_count_re, - matches_re as cpp_matches_re + matches_re as cpp_matches_re, ) -from libcpp.string cimport string +from cudf._lib.scalar cimport DeviceScalar def contains_re(Column source_strings, object reg_ex): diff --git a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx index e002d630fc3..6eb8984b869 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx @@ -3,27 +3,26 @@ import numpy as np from cudf._lib.column cimport Column + from cudf._lib.types import np_to_cudf_types -from cudf._lib.types cimport underlying_type_t_type_id + from cudf._lib.cpp.types cimport DECIMAL64 +from cudf._lib.types cimport underlying_type_t_type_id from cudf.core.column.column import as_column +from libcpp.memory cimport unique_ptr +from libcpp.string cimport string +from libcpp.utility cimport move + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.convert.convert_fixed_point cimport ( - to_fixed_point as cpp_to_fixed_point, from_fixed_point as cpp_from_fixed_point, - is_fixed_point as cpp_is_fixed_point -) -from cudf._lib.cpp.types cimport ( - type_id, - data_type, + is_fixed_point as cpp_is_fixed_point, + to_fixed_point as cpp_to_fixed_point, ) - -from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move -from libcpp.string cimport string +from cudf._lib.cpp.types cimport data_type, type_id def from_decimal(Column input_col): diff --git a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx index 195d9b71f6e..d47b1e6e651 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx @@ -4,10 +4,9 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.convert.convert_floats cimport ( is_float as cpp_is_float, ) diff --git a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx index d1bae1edd37..08bcca93086 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx @@ -4,10 +4,9 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.convert.convert_integers cimport ( is_integer as cpp_is_integer, ) diff --git a/python/cudf/cudf/_lib/strings/convert/convert_urls.pyx b/python/cudf/cudf/_lib/strings/convert/convert_urls.pyx index 6aab99b3ec5..c391719e853 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_urls.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_urls.pyx @@ -2,13 +2,13 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view + from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.convert.convert_urls cimport ( - url_encode as cpp_url_encode, url_decode as cpp_url_decode, + url_encode as cpp_url_encode, ) diff --git a/python/cudf/cudf/_lib/strings/extract.pyx b/python/cudf/cudf/_lib/strings/extract.pyx index 5828b62b999..58558fade24 100644 --- a/python/cudf/cudf/_lib/strings/extract.pyx +++ b/python/cudf/cudf/_lib/strings/extract.pyx @@ -1,20 +1,17 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move + from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.strings.extract cimport extract as cpp_extract from cudf._lib.cpp.table.table cimport table +from cudf._lib.scalar cimport DeviceScalar from cudf._lib.table cimport Table -from cudf._lib.cpp.column.column cimport column - -from cudf._lib.cpp.strings.extract cimport ( - extract as cpp_extract -) -from libcpp.string cimport string - def extract(Column source_strings, object pattern): """ diff --git a/python/cudf/cudf/_lib/strings/find.pyx b/python/cudf/cudf/_lib/strings/find.pyx index 3a360d31ef2..788c0a2524a 100644 --- a/python/cudf/cudf/_lib/strings/find.pyx +++ b/python/cudf/cudf/_lib/strings/find.pyx @@ -1,21 +1,21 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type - from cudf._lib.cpp.strings.find cimport ( contains as cpp_contains, ends_with as cpp_ends_with, - starts_with as cpp_starts_with, find as cpp_find, - rfind as cpp_rfind + rfind as cpp_rfind, + starts_with as cpp_starts_with, ) +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar def contains(Column source_strings, object py_target): diff --git a/python/cudf/cudf/_lib/strings/find_multiple.pyx b/python/cudf/cudf/_lib/strings/find_multiple.pyx index 5c33be07d15..4ac86ce4ef5 100644 --- a/python/cudf/cudf/_lib/strings/find_multiple.pyx +++ b/python/cudf/cudf/_lib/strings/find_multiple.pyx @@ -1,11 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.find_multiple cimport ( find_multiple as cpp_find_multiple, ) diff --git a/python/cudf/cudf/_lib/strings/findall.pyx b/python/cudf/cudf/_lib/strings/findall.pyx index 7dbfbe62def..cc5730c467d 100644 --- a/python/cudf/cudf/_lib/strings/findall.pyx +++ b/python/cudf/cudf/_lib/strings/findall.pyx @@ -1,20 +1,17 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.cpp.table.table cimport table -from cudf._lib.table cimport Table +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar - -from cudf._lib.cpp.strings.findall cimport ( - findall_re as cpp_findall_re -) -from libcpp.string cimport string +from cudf._lib.cpp.strings.findall cimport findall_re as cpp_findall_re +from cudf._lib.cpp.table.table cimport table +from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.table cimport Table def findall(Column source_strings, pattern): diff --git a/python/cudf/cudf/_lib/strings/json.pyx b/python/cudf/cudf/_lib/strings/json.pyx index 211bbe9d4f0..c7545b6e481 100644 --- a/python/cudf/cudf/_lib/strings/json.pyx +++ b/python/cudf/cudf/_lib/strings/json.pyx @@ -2,16 +2,14 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar +from cudf._lib.cpp.strings.json cimport get_json_object as cpp_get_json_object from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.cpp.column.column cimport column - -from cudf._lib.cpp.strings.json cimport ( - get_json_object as cpp_get_json_object -) def get_json_object(Column col, object py_json_path): diff --git a/python/cudf/cudf/_lib/strings/padding.pyx b/python/cudf/cudf/_lib/strings/padding.pyx index 52c66495d92..c7b97977d60 100644 --- a/python/cudf/cudf/_lib/strings/padding.pyx +++ b/python/cudf/cudf/_lib/strings/padding.pyx @@ -2,19 +2,22 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column from cudf._lib.scalar cimport DeviceScalar + from enum import IntEnum + from libcpp.string cimport string -from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.strings.padding cimport ( pad as cpp_pad, + pad_side as pad_side, zfill as cpp_zfill, - pad_side as pad_side ) from cudf._lib.strings.padding cimport underlying_type_t_pad_side diff --git a/python/cudf/cudf/_lib/strings/replace.pyx b/python/cudf/cudf/_lib/strings/replace.pyx index 429e356be4a..f5c47d2a2ed 100644 --- a/python/cudf/cudf/_lib/strings/replace.pyx +++ b/python/cudf/cudf/_lib/strings/replace.pyx @@ -1,24 +1,20 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport int32_t from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type + from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.cpp.column.column cimport column - -from libc.stdint cimport int32_t - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.replace cimport ( + replace as cpp_replace, replace_slice as cpp_replace_slice, - replace as cpp_replace -) - -from cudf._lib.cpp.strings.substring cimport ( - slice_strings as cpp_slice_strings ) +from cudf._lib.cpp.strings.substring cimport slice_strings as cpp_slice_strings +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar def slice_replace(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/replace_re.pyx b/python/cudf/cudf/_lib/strings/replace_re.pyx index 7993e3a172f..20fb903c60c 100644 --- a/python/cudf/cudf/_lib/strings/replace_re.pyx +++ b/python/cudf/cudf/_lib/strings/replace_re.pyx @@ -1,21 +1,20 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.cpp.types cimport size_type from libcpp.vector cimport vector +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar - from cudf._lib.cpp.strings.replace_re cimport ( replace_re as cpp_replace_re, - replace_with_backrefs as cpp_replace_with_backrefs + replace_with_backrefs as cpp_replace_with_backrefs, ) -from libcpp.string cimport string +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar def replace_re(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/split/partition.pyx b/python/cudf/cudf/_lib/strings/split/partition.pyx index 64d625bcb26..590de5bf526 100644 --- a/python/cudf/cudf/_lib/strings/split/partition.pyx +++ b/python/cudf/cudf/_lib/strings/split/partition.pyx @@ -1,23 +1,22 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column -from cudf._lib.table cimport Table +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.scalar cimport DeviceScalar -from libcpp.string cimport string - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.split.partition cimport ( partition as cpp_partition, rpartition as cpp_rpartition, ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.table cimport Table def partition(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/split/split.pyx b/python/cudf/cudf/_lib/strings/split/split.pyx index 2dd66f99ad5..599f7602b51 100644 --- a/python/cudf/cudf/_lib/strings/split/split.pyx +++ b/python/cudf/cudf/_lib/strings/split/split.pyx @@ -1,25 +1,24 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column -from cudf._lib.table cimport Table -from cudf._lib.cpp.table.table cimport table +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.scalar cimport DeviceScalar -from libcpp.string cimport string - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.split.split cimport ( - split as cpp_split, rsplit as cpp_rsplit, + rsplit_record as cpp_rsplit_record, + split as cpp_split, split_record as cpp_split_record, - rsplit_record as cpp_rsplit_record ) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.table cimport Table def split(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/strip.pyx b/python/cudf/cudf/_lib/strings/strip.pyx index 72dffa3d897..d3430a53cc6 100644 --- a/python/cudf/cudf/_lib/strings/strip.pyx +++ b/python/cudf/cudf/_lib/strings/strip.pyx @@ -1,19 +1,19 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr +from libcpp.string cimport string from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type + from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar -from libcpp.string cimport string from cudf._lib.cpp.column.column cimport column - +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.strip cimport ( strip as cpp_strip, - strip_type as strip_type + strip_type as strip_type, ) +from cudf._lib.cpp.types cimport size_type +from cudf._lib.scalar cimport DeviceScalar def strip(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/substring.pyx b/python/cudf/cudf/_lib/strings/substring.pyx index add9e67b09f..761e9503aba 100644 --- a/python/cudf/cudf/_lib/strings/substring.pyx +++ b/python/cudf/cudf/_lib/strings/substring.pyx @@ -1,20 +1,21 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf._lib.cpp.column.column_view cimport column_view from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + from cudf._lib.column cimport Column -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.types cimport size_type + import numpy as np -from cudf._lib.cpp.strings.substring cimport ( - slice_strings as cpp_slice_strings -) +from cudf._lib.cpp.strings.substring cimport slice_strings as cpp_slice_strings from cudf._lib.scalar import as_device_scalar -from cudf._lib.scalar cimport DeviceScalar + from cudf._lib.cpp.scalar.scalar cimport numeric_scalar +from cudf._lib.scalar cimport DeviceScalar def slice_strings(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/translate.pyx b/python/cudf/cudf/_lib/strings/translate.pyx index 32b145736ca..7a5cf502ba3 100644 --- a/python/cudf/cudf/_lib/strings/translate.pyx +++ b/python/cudf/cudf/_lib/strings/translate.pyx @@ -2,21 +2,21 @@ from libcpp cimport bool from libcpp.memory cimport unique_ptr +from libcpp.pair cimport pair from libcpp.utility cimport move +from libcpp.vector cimport vector +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.translate cimport ( - translate as cpp_translate, + filter_characters as cpp_filter_characters, filter_type as filter_type, - filter_characters as cpp_filter_characters + translate as cpp_translate, ) -from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar -from libcpp.vector cimport vector -from libcpp.pair cimport pair from cudf._lib.cpp.types cimport char_utf8 +from cudf._lib.scalar cimport DeviceScalar def translate(Column source_strings, diff --git a/python/cudf/cudf/_lib/strings/wrap.pyx b/python/cudf/cudf/_lib/strings/wrap.pyx index 814df1f1a72..5ebc33f77ef 100644 --- a/python/cudf/cudf/_lib/strings/wrap.pyx +++ b/python/cudf/cudf/_lib/strings/wrap.pyx @@ -2,14 +2,12 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move -from cudf._lib.cpp.column.column_view cimport column_view + +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.strings.wrap cimport wrap as cpp_wrap from cudf._lib.cpp.types cimport size_type -from cudf._lib.column cimport Column - -from cudf._lib.cpp.strings.wrap cimport ( - wrap as cpp_wrap -) def wrap(Column source_strings, diff --git a/python/cudf/cudf/_lib/table.pxd b/python/cudf/cudf/_lib/table.pxd index ff0223b2519..e1bffbc3864 100644 --- a/python/cudf/cudf/_lib/table.pxd +++ b/python/cudf/cudf/_lib/table.pxd @@ -3,9 +3,7 @@ from libcpp.memory cimport unique_ptr from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport ( - table_view, mutable_table_view -) +from cudf._lib.cpp.table.table_view cimport mutable_table_view, table_view cdef class Table: diff --git a/python/cudf/cudf/_lib/table.pyi b/python/cudf/cudf/_lib/table.pyi index 772e940f812..2a5dfb2a4dd 100644 --- a/python/cudf/cudf/_lib/table.pyi +++ b/python/cudf/cudf/_lib/table.pyi @@ -1,6 +1,6 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from typing import List, Any, Optional, TYPE_CHECKING +from typing import TYPE_CHECKING, Any, List, Optional import cudf diff --git a/python/cudf/cudf/_lib/table.pyx b/python/cudf/cudf/_lib/table.pyx index 93d79ba6843..07d7a0fcf02 100644 --- a/python/cudf/cudf/_lib/table.pyx +++ b/python/cudf/cudf/_lib/table.pyx @@ -8,23 +8,16 @@ from cudf.core.column_accessor import ColumnAccessor from cython.operator cimport dereference from libc.stdint cimport uintptr_t -from libcpp.vector cimport vector from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from libcpp.vector cimport vector from cudf._lib.column cimport Column - -from cudf._lib.cpp.types cimport size_type from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, - mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport ( - table_view, - mutable_table_view -) +from cudf._lib.cpp.table.table_view cimport mutable_table_view, table_view +from cudf._lib.cpp.types cimport size_type cdef class Table: diff --git a/python/cudf/cudf/_lib/transform.pyx b/python/cudf/cudf/_lib/transform.pyx index 2c83f8b86e0..c8b448b6e30 100644 --- a/python/cudf/cudf/_lib/transform.pyx +++ b/python/cudf/cudf/_lib/transform.pyx @@ -1,33 +1,32 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -import cudf import numpy as np + +import cudf from cudf.utils import cudautils from libc.stdint cimport uintptr_t - -from libcpp.string cimport string from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move from libcpp.pair cimport pair +from libcpp.string cimport string +from libcpp.utility cimport move + +from rmm._lib.device_buffer cimport DeviceBuffer, device_buffer from cudf._lib.column cimport Column from cudf._lib.table cimport Table -from rmm._lib.device_buffer cimport device_buffer, DeviceBuffer + from cudf.core.buffer import Buffer -from cudf._lib.cpp.types cimport ( - bitmask_type, - data_type, - size_type, - type_id, -) +from cudf._lib.cpp.types cimport bitmask_type, data_type, size_type, type_id + from cudf._lib.types import np_to_cudf_types -from cudf._lib.types cimport underlying_type_t_type_id + from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.types cimport underlying_type_t_type_id from numba.np import numpy_support diff --git a/python/cudf/cudf/_lib/transpose.pyx b/python/cudf/cudf/_lib/transpose.pyx index d2b053789cd..d12cfa7511d 100644 --- a/python/cudf/cudf/_lib/transpose.pyx +++ b/python/cudf/cudf/_lib/transpose.pyx @@ -4,19 +4,16 @@ import cudf from cudf.utils.dtypes import is_categorical_dtype from libcpp.memory cimport unique_ptr -from libcpp.utility cimport move from libcpp.pair cimport pair +from libcpp.utility cimport move from cudf._lib.column cimport Column -from cudf._lib.table cimport Table - -from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.transpose cimport ( - transpose as cpp_transpose -) +from cudf._lib.cpp.table.table cimport table +from cudf._lib.cpp.table.table_view cimport table_view +from cudf._lib.cpp.transpose cimport transpose as cpp_transpose +from cudf._lib.table cimport Table def transpose(Table source): diff --git a/python/cudf/cudf/_lib/types.pxd b/python/cudf/cudf/_lib/types.pxd index 383b3665bd9..dbbe9b1e05a 100644 --- a/python/cudf/cudf/_lib/types.pxd +++ b/python/cudf/cudf/_lib/types.pxd @@ -2,9 +2,10 @@ from libc.stdint cimport int32_t from libcpp cimport bool + +cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view -cimport cudf._lib.cpp.types as libcudf_types ctypedef bool underlying_type_t_order ctypedef bool underlying_type_t_null_order diff --git a/python/cudf/cudf/_lib/types.pyx b/python/cudf/cudf/_lib/types.pyx index 43e5c213947..d93e1b75376 100644 --- a/python/cudf/cudf/_lib/types.pyx +++ b/python/cudf/cudf/_lib/types.pyx @@ -4,29 +4,31 @@ from enum import IntEnum import numpy as np -from libcpp.memory cimport shared_ptr, make_shared +from libcpp.memory cimport make_shared, shared_ptr +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.types cimport ( - underlying_type_t_order, + underlying_type_t_interpolation, underlying_type_t_null_order, + underlying_type_t_order, underlying_type_t_sorted, - underlying_type_t_interpolation ) -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view + from cudf.core.dtypes import ( + Decimal32Dtype, + Decimal64Dtype, ListDtype, StructDtype, - Decimal64Dtype, - Decimal32Dtype ) from cudf.utils.dtypes import ( + is_decimal32_dtype, + is_decimal64_dtype, is_decimal_dtype, is_list_dtype, is_struct_dtype, - is_decimal64_dtype, - is_decimal32_dtype ) + cimport cudf._lib.cpp.types as libcudf_types diff --git a/python/cudf/cudf/_lib/unary.pyx b/python/cudf/cudf/_lib/unary.pyx index 3bac0cde9c6..c06723fe442 100644 --- a/python/cudf/cudf/_lib/unary.pyx +++ b/python/cudf/cudf/_lib/unary.pyx @@ -1,34 +1,29 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. from enum import IntEnum + from cudf.utils.dtypes import is_decimal_dtype from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move + import numpy as np from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport ( - column_view, mutable_column_view -) +from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view + from cudf._lib.types import np_to_cudf_types -from cudf._lib.cpp.types cimport ( - size_type, - data_type, - type_id, -) -from cudf._lib.column import np_to_cudf_types, cudf_to_np_types -from cudf._lib.cpp.unary cimport ( - underlying_type_t_unary_op, - unary_operator, -) - -from cudf._lib.types cimport underlying_type_t_type_id, dtype_to_data_type -cimport cudf._lib.cpp.unary as libcudf_unary +from cudf._lib.cpp.types cimport data_type, size_type, type_id + +from cudf._lib.column import cudf_to_np_types, np_to_cudf_types + cimport cudf._lib.cpp.types as libcudf_types +cimport cudf._lib.cpp.unary as libcudf_unary +from cudf._lib.cpp.unary cimport unary_operator, underlying_type_t_unary_op +from cudf._lib.types cimport dtype_to_data_type, underlying_type_t_type_id class UnaryOp(IntEnum): diff --git a/python/cudf/cudf/_lib/utils.pxd b/python/cudf/cudf/_lib/utils.pxd index 03a032ac131..e8ac858d8b2 100644 --- a/python/cudf/cudf/_lib/utils.pxd +++ b/python/cudf/cudf/_lib/utils.pxd @@ -2,10 +2,12 @@ from libcpp.string cimport string from libcpp.vector cimport vector + from cudf._lib.cpp.column.column cimport column_view from cudf._lib.cpp.table.table cimport table_view from cudf._lib.table cimport Table + cdef vector[column_view] make_column_views(object columns) except* cdef vector[table_view] make_table_views(object tables) except* cdef vector[table_view] make_table_data_views(object tables) except* diff --git a/python/cudf/cudf/_lib/utils.pyx b/python/cudf/cudf/_lib/utils.pyx index e5dfb5a5c35..0a8218fee44 100644 --- a/python/cudf/cudf/_lib/utils.pyx +++ b/python/cudf/cudf/_lib/utils.pyx @@ -1,29 +1,29 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -import cudf - import pyarrow as pa -from cudf._lib.column cimport Column -from cudf._lib.table cimport Table -from cudf._lib.cpp.column.column cimport column_view -from cudf._lib.cpp.table.table cimport table_view +import cudf from libc.stdint cimport uint8_t from libcpp.string cimport string from libcpp.vector cimport vector +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column_view +from cudf._lib.cpp.table.table cimport table_view +from cudf._lib.table cimport Table + try: import ujson as json except ImportError: import json from cudf.utils.dtypes import ( - np_to_pa_dtype, is_categorical_dtype, + is_decimal_dtype, is_list_dtype, is_struct_dtype, - is_decimal_dtype, + np_to_pa_dtype, ) diff --git a/python/cudf/cudf/api/extensions/accessor.py b/python/cudf/cudf/api/extensions/accessor.py index 2d9fdcaaed3..a27ffa90cfc 100644 --- a/python/cudf/cudf/api/extensions/accessor.py +++ b/python/cudf/cudf/api/extensions/accessor.py @@ -1,11 +1,11 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from cudf.utils.docutils import docfmt_partial import warnings -import cudf from pandas.core.accessor import CachedAccessor +import cudf +from cudf.utils.docutils import docfmt_partial _docstring_register_accessor = """ Extends `cudf.{klass}` with custom defined accessor diff --git a/python/cudf/cudf/benchmarks/bench_cudf_io.py b/python/cudf/cudf/benchmarks/bench_cudf_io.py index 1a01904374c..20f5afa1eaf 100644 --- a/python/cudf/cudf/benchmarks/bench_cudf_io.py +++ b/python/cudf/cudf/benchmarks/bench_cudf_io.py @@ -1,11 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -import pytest -import cudf import glob import io + +import pytest from conftest import option +import cudf + def get_dataset_dir(): if option.dataset_dir == "NONE": diff --git a/python/cudf/cudf/benchmarks/get_datasets.py b/python/cudf/cudf/benchmarks/get_datasets.py index c793970eb3f..f3b66eda512 100644 --- a/python/cudf/cudf/benchmarks/get_datasets.py +++ b/python/cudf/cudf/benchmarks/get_datasets.py @@ -1,8 +1,8 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +import argparse import os import shutil -import argparse from collections import namedtuple # Update url and dir where datasets needs to be copied diff --git a/python/cudf/cudf/core/cut.py b/python/cudf/cudf/core/cut.py index 63324dea354..7811f477170 100644 --- a/python/cudf/cudf/core/cut.py +++ b/python/cudf/cudf/core/cut.py @@ -1,13 +1,14 @@ -from cudf._lib.labeling import label_bins -from cudf.core.column import as_column -from cudf.core.column import build_categorical_column -from cudf.core.index import IntervalIndex, interval_range -from cudf.utils.dtypes import is_list_like +from collections.abc import Sequence + import cupy -import cudf import numpy as np import pandas as pd -from collections.abc import Sequence + +import cudf +from cudf._lib.labeling import label_bins +from cudf.core.column import as_column, build_categorical_column +from cudf.core.index import IntervalIndex, interval_range +from cudf.utils.dtypes import is_list_like # from cudf._lib.filling import sequence diff --git a/python/cudf/cudf/core/subword_tokenizer.py b/python/cudf/cudf/core/subword_tokenizer.py index 9058491d8e7..60139f7d7af 100644 --- a/python/cudf/cudf/core/subword_tokenizer.py +++ b/python/cudf/cudf/core/subword_tokenizer.py @@ -1,13 +1,15 @@ # Copyright (c) 2021, NVIDIA CORPORATION. from __future__ import annotations + from typing import Union -import cupy as cp from warnings import warn +import cupy as cp + from cudf._lib.nvtext.subword_tokenize import ( - subword_tokenize_inmem_hash as cpp_subword_tokenize, Hashed_Vocabulary as cpp_hashed_vocabulary, + subword_tokenize_inmem_hash as cpp_subword_tokenize, ) diff --git a/python/cudf/cudf/tests/test_compile_udf.py b/python/cudf/cudf/tests/test_compile_udf.py index 96c0e91d8d7..d965f35ccdd 100644 --- a/python/cudf/cudf/tests/test_compile_udf.py +++ b/python/cudf/cudf/tests/test_compile_udf.py @@ -1,8 +1,9 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from cudf.utils import cudautils from numba import types +from cudf.utils import cudautils + def setup_function(): cudautils._udf_code_cache.clear() diff --git a/python/cudf/cudf/tests/test_hash_vocab.py b/python/cudf/cudf/tests/test_hash_vocab.py index 529552cb2d9..a30f4e20849 100644 --- a/python/cudf/cudf/tests/test_hash_vocab.py +++ b/python/cudf/cudf/tests/test_hash_vocab.py @@ -1,9 +1,11 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -from cudf.utils.hash_vocab_utils import hash_vocab -import os import filecmp +import os + import pytest +from cudf.utils.hash_vocab_utils import hash_vocab + @pytest.fixture(scope="module") def datadir(datadir): diff --git a/python/cudf/cudf/tests/test_subword_tokenizer.py b/python/cudf/cudf/tests/test_subword_tokenizer.py index bdb343a41f7..d5207c79b86 100644 --- a/python/cudf/cudf/tests/test_subword_tokenizer.py +++ b/python/cudf/cudf/tests/test_subword_tokenizer.py @@ -1,8 +1,9 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. -from transformers import BertTokenizer -import pytest import os + import numpy as np +import pytest +from transformers import BertTokenizer import cudf from cudf.core.subword_tokenizer import SubwordTokenizer diff --git a/python/cudf/cudf/tests/test_udf_binops.py b/python/cudf/cudf/tests/test_udf_binops.py index 00d05a8c3a5..df7361ab183 100644 --- a/python/cudf/cudf/tests/test_udf_binops.py +++ b/python/cudf/cudf/tests/test_udf_binops.py @@ -3,14 +3,13 @@ import numpy as np import pytest +from numba.cuda import compile_ptx +from numba.np import numpy_support from cudf import _lib as libcudf from cudf.core import Series from cudf.utils import dtypes as dtypeutils -from numba.cuda import compile_ptx -from numba.np import numpy_support - @pytest.mark.parametrize( "dtype", sorted(list(dtypeutils.NUMERIC_TYPES - {"int8"})) diff --git a/python/cudf/cudf/utils/applyutils.py b/python/cudf/cudf/utils/applyutils.py index 610b0997d85..c8fb7c1a47d 100644 --- a/python/cudf/cudf/utils/applyutils.py +++ b/python/cudf/cudf/utils/applyutils.py @@ -4,6 +4,7 @@ from typing import Any, Dict from numba import cuda +from numba.core.utils import pysignature import cudf from cudf import _lib as libcudf @@ -11,9 +12,6 @@ from cudf.utils import utils from cudf.utils.docutils import docfmt_partial -from numba.core.utils import pysignature - - _doc_applyparams = """ df : DataFrame The source dataframe. diff --git a/python/cudf/cudf/utils/cudautils.py b/python/cudf/cudf/utils/cudautils.py index 262fe304dd8..df3b6ec3d93 100755 --- a/python/cudf/cudf/utils/cudautils.py +++ b/python/cudf/cudf/utils/cudautils.py @@ -4,11 +4,9 @@ import cachetools import numpy as np from numba import cuda - -import cudf - from numba.np import numpy_support +import cudf # # Misc kernels diff --git a/python/cudf_kafka/cudf_kafka/_lib/kafka.pxd b/python/cudf_kafka/cudf_kafka/_lib/kafka.pxd index d7c310fc6e2..fc985e58b68 100644 --- a/python/cudf_kafka/cudf_kafka/_lib/kafka.pxd +++ b/python/cudf_kafka/cudf_kafka/_lib/kafka.pxd @@ -1,12 +1,13 @@ # Copyright (c) 2020, NVIDIA CORPORATION. +from libc.stdint cimport int32_t, int64_t +from libcpp cimport bool +from libcpp.map cimport map +from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.vector cimport vector -from libcpp.map cimport map -from libcpp cimport bool -from libc.stdint cimport int32_t, int64_t + from cudf._lib.cpp.io.types cimport datasource -from libcpp.memory cimport unique_ptr from cudf._lib.io.datasource cimport Datasource diff --git a/python/cudf_kafka/cudf_kafka/_lib/kafka.pyx b/python/cudf_kafka/cudf_kafka/_lib/kafka.pyx index fad62eb38b0..5588b69938b 100644 --- a/python/cudf_kafka/cudf_kafka/_lib/kafka.pyx +++ b/python/cudf_kafka/cudf_kafka/_lib/kafka.pyx @@ -1,13 +1,16 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp.string cimport string -from libcpp.map cimport map from libc.stdint cimport int32_t, int64_t from libcpp cimport bool +from libcpp.map cimport map +from libcpp.memory cimport make_unique, unique_ptr +from libcpp.string cimport string + from cudf._lib.cpp.io.types cimport datasource -from libcpp.memory cimport unique_ptr, make_unique + from cudf_kafka._lib.kafka cimport kafka_consumer + cdef class KafkaDatasource(Datasource): def __cinit__(self, diff --git a/python/custreamz/custreamz/tests/test_dataframes.py b/python/custreamz/custreamz/tests/test_dataframes.py index d5fffd30d57..24f6e46f6c5 100644 --- a/python/custreamz/custreamz/tests/test_dataframes.py +++ b/python/custreamz/custreamz/tests/test_dataframes.py @@ -12,13 +12,14 @@ import numpy as np import pandas as pd import pytest -from streamz import Stream -from streamz.dask import DaskStream -from streamz.dataframe import Aggregation, DataFrame, DataFrames, Series from dask.dataframe.utils import assert_eq from distributed import Client +from streamz import Stream +from streamz.dask import DaskStream +from streamz.dataframe import Aggregation, DataFrame, DataFrames, Series + cudf = pytest.importorskip("cudf") diff --git a/python/dask_cudf/dask_cudf/io/tests/test_json.py b/python/dask_cudf/dask_cudf/io/tests/test_json.py index 3a1e98feb31..fb5217ceed7 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_json.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_json.py @@ -4,11 +4,12 @@ import pytest import dask -import dask.dataframe as dd from dask.utils import tmpfile import dask_cudf +import dask.dataframe as dd # isort:skip + def test_read_json(tmp_path): df1 = dask.datasets.timeseries( diff --git a/python/dask_cudf/dask_cudf/tests/test_accessor.py b/python/dask_cudf/dask_cudf/tests/test_accessor.py index 94e0169bdf9..342f2b60180 100644 --- a/python/dask_cudf/dask_cudf/tests/test_accessor.py +++ b/python/dask_cudf/dask_cudf/tests/test_accessor.py @@ -5,11 +5,11 @@ from dask import dataframe as dd -import dask_cudf as dgd - from cudf import DataFrame, Series from cudf.testing._utils import assert_eq, does_not_raise +import dask_cudf as dgd + ############################################################################# # Datetime Accessor # ############################################################################# diff --git a/python/dask_cudf/dask_cudf/tests/test_delayed_io.py b/python/dask_cudf/dask_cudf/tests/test_delayed_io.py index a103d9fe8c2..7789664afae 100644 --- a/python/dask_cudf/dask_cudf/tests/test_delayed_io.py +++ b/python/dask_cudf/dask_cudf/tests/test_delayed_io.py @@ -7,10 +7,10 @@ from dask.delayed import delayed -import dask_cudf as dgd - import cudf as gd +import dask_cudf as dgd + @delayed def load_data(nelem, ident): diff --git a/python/dask_cudf/dask_cudf/tests/test_join.py b/python/dask_cudf/dask_cudf/tests/test_join.py index d8781af6c6e..58811ee98fc 100644 --- a/python/dask_cudf/dask_cudf/tests/test_join.py +++ b/python/dask_cudf/dask_cudf/tests/test_join.py @@ -6,10 +6,10 @@ from dask import dataframe as dd -import dask_cudf as dgd - import cudf +import dask_cudf as dgd + param_nrows = [5, 10, 50, 100] diff --git a/python/dask_cudf/dask_cudf/tests/test_reductions.py b/python/dask_cudf/dask_cudf/tests/test_reductions.py index 030b7717fbc..c34fbc3b0e7 100644 --- a/python/dask_cudf/dask_cudf/tests/test_reductions.py +++ b/python/dask_cudf/dask_cudf/tests/test_reductions.py @@ -6,10 +6,10 @@ from dask import dataframe as dd -import dask_cudf as dgd - import cudf +import dask_cudf as dgd + def _make_random_frame(nelem, npartitions=2): df = pd.DataFrame( diff --git a/python/dask_cudf/dask_cudf/tests/test_sort.py b/python/dask_cudf/dask_cudf/tests/test_sort.py index 855b2bb9a0b..a12d5792219 100644 --- a/python/dask_cudf/dask_cudf/tests/test_sort.py +++ b/python/dask_cudf/dask_cudf/tests/test_sort.py @@ -4,10 +4,10 @@ import dask from dask import dataframe as dd -import dask_cudf - import cudf +import dask_cudf + @pytest.mark.parametrize("by", ["a", "b", "c", "d", ["a", "b"], ["c", "d"]]) @pytest.mark.parametrize("nelem", [10, 500])