From b848ccc5d9414a8fa3cbe723e4885ce66ac5a093 Mon Sep 17 00:00:00 2001 From: Wei He Date: Mon, 2 Dec 2024 18:25:15 -0800 Subject: [PATCH] refactor: Extract the definition of Vector::Options::TimestampPrecision to Util.h (#11722) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11722 Differential Revision: D65576378 --- velox/vector/fuzzer/Utils.h | 7 +++++++ velox/vector/fuzzer/VectorFuzzer.h | 9 ++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/velox/vector/fuzzer/Utils.h b/velox/vector/fuzzer/Utils.h index 5f51c3a52024f..0248b08f942fa 100644 --- a/velox/vector/fuzzer/Utils.h +++ b/velox/vector/fuzzer/Utils.h @@ -23,6 +23,13 @@ namespace facebook::velox { using FuzzerGenerator = std::mt19937; +enum class FuzzerTimestampPrecision : int8_t { + kNanoSeconds = 0, + kMicroSeconds = 1, + kMilliSeconds = 2, + kSeconds = 3, +}; + namespace generator_spec_utils { bool coinToss(FuzzerGenerator& rng, double threshold); diff --git a/velox/vector/fuzzer/VectorFuzzer.h b/velox/vector/fuzzer/VectorFuzzer.h index 6ebbf03dc0a65..0cd9a510305c7 100644 --- a/velox/vector/fuzzer/VectorFuzzer.h +++ b/velox/vector/fuzzer/VectorFuzzer.h @@ -17,12 +17,12 @@ #pragma once #include -#include #include "velox/type/Type.h" #include "velox/vector/BaseVector.h" #include "velox/vector/ComplexVector.h" #include "velox/vector/fuzzer/GeneratorSpec.h" +#include "velox/vector/fuzzer/Utils.h" namespace facebook::velox { @@ -140,12 +140,7 @@ class VectorFuzzer { /// Control the precision of timestamps generated. By default generate using /// nanoseconds precision. - enum class TimestampPrecision : int8_t { - kNanoSeconds = 0, - kMicroSeconds = 1, - kMilliSeconds = 2, - kSeconds = 3, - }; + using TimestampPrecision = FuzzerTimestampPrecision; TimestampPrecision timestampPrecision{TimestampPrecision::kNanoSeconds}; /// If true, fuzz() will randomly generate lazy vectors and fuzzInputRow()