diff options
author | gvit <gvit@ydb.tech> | 2022-10-10 15:15:20 +0300 |
---|---|---|
committer | gvit <gvit@ydb.tech> | 2022-10-10 15:15:20 +0300 |
commit | 6e51dcf19c076b2fe01b73080dd31d4de163f30b (patch) | |
tree | d31a7c98f7d5ff30dae5fee1f50373e8006ac555 | |
parent | fc0c8d87b9e0550c098581e408b6a2f2d0f878d8 (diff) | |
download | ydb-6e51dcf19c076b2fe01b73080dd31d4de163f30b.tar.gz |
add test to reproduce the bug
-rw-r--r-- | library/cpp/yt/cpu_clock/clock-inl.h | 14 | ||||
-rw-r--r-- | ydb/core/kqp/ut/CMakeLists.darwin.txt | 1 | ||||
-rw-r--r-- | ydb/core/kqp/ut/CMakeLists.linux.txt | 1 | ||||
-rw-r--r-- | ydb/core/kqp/ut/common/kqp_ut_common.cpp | 3 | ||||
-rw-r--r-- | ydb/core/kqp/ut/kqp_join_ut.cpp | 100 |
5 files changed, 113 insertions, 6 deletions
diff --git a/library/cpp/yt/cpu_clock/clock-inl.h b/library/cpp/yt/cpu_clock/clock-inl.h index ecec035618..f686822103 100644 --- a/library/cpp/yt/cpu_clock/clock-inl.h +++ b/library/cpp/yt/cpu_clock/clock-inl.h @@ -5,10 +5,12 @@ #include "clock.h" #endif -#ifdef _WIN32 -# include <intrin.h> -#else -# include <x86intrin.h> +#if !defined(__arm__) && !defined(__aarch64__) +# ifdef _WIN32 +# include <intrin.h> +# else +# include <x86intrin.h> +# endif #endif namespace NYT { @@ -17,7 +19,11 @@ namespace NYT { inline TCpuInstant GetCpuInstant() { +#if !defined(__arm__) && !defined(__aarch64__) return __rdtsc(); +#else + return MicroSeconds(); +#endif } //////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/kqp/ut/CMakeLists.darwin.txt b/ydb/core/kqp/ut/CMakeLists.darwin.txt index 7f2431236f..38e9bd0e8f 100644 --- a/ydb/core/kqp/ut/CMakeLists.darwin.txt +++ b/ydb/core/kqp/ut/CMakeLists.darwin.txt @@ -34,6 +34,7 @@ target_link_libraries(ydb-core-kqp-ut PUBLIC cpp-client-ydb_proto yql-sql-pg_dummy re2_udf + digest_udf ) target_link_options(ydb-core-kqp-ut PRIVATE -Wl,-no_deduplicate diff --git a/ydb/core/kqp/ut/CMakeLists.linux.txt b/ydb/core/kqp/ut/CMakeLists.linux.txt index c5fa765a09..6db7d4496d 100644 --- a/ydb/core/kqp/ut/CMakeLists.linux.txt +++ b/ydb/core/kqp/ut/CMakeLists.linux.txt @@ -36,6 +36,7 @@ target_link_libraries(ydb-core-kqp-ut PUBLIC cpp-client-ydb_proto yql-sql-pg_dummy re2_udf + digest_udf ) target_link_options(ydb-core-kqp-ut PRIVATE -ldl diff --git a/ydb/core/kqp/ut/common/kqp_ut_common.cpp b/ydb/core/kqp/ut/common/kqp_ut_common.cpp index b39fb6bba4..a7204e535a 100644 --- a/ydb/core/kqp/ut/common/kqp_ut_common.cpp +++ b/ydb/core/kqp/ut/common/kqp_ut_common.cpp @@ -10,7 +10,6 @@ #include <ydb/library/yql/public/udf/udf_value_builder.h> #include <ydb/library/yql/minikql/invoke_builtins/mkql_builtins.h> #include <ydb/library/yql/utils/yql_panic.h> -#include <ydb/library/yql/udfs/common/re2/re2_udf.cpp> namespace NKikimr { namespace NKqp { @@ -56,7 +55,7 @@ NMiniKQL::IFunctionRegistry* UdfFrFactory(const NScheme::TTypeRegistry& typeRegi Y_UNUSED(typeRegistry); auto funcRegistry = NMiniKQL::CreateFunctionRegistry(NMiniKQL::CreateBuiltinRegistry())->Clone(); funcRegistry->AddModule("", "TestUdfs", new TTestUdfsModule()); - funcRegistry->AddModule("re2_path", "Re2", new TRe2Module<true>()); + NKikimr::NMiniKQL::FillStaticModules(*funcRegistry); return funcRegistry.Release(); } diff --git a/ydb/core/kqp/ut/kqp_join_ut.cpp b/ydb/core/kqp/ut/kqp_join_ut.cpp index 759a492fc0..e5fd92a58f 100644 --- a/ydb/core/kqp/ut/kqp_join_ut.cpp +++ b/ydb/core/kqp/ut/kqp_join_ut.cpp @@ -303,6 +303,106 @@ Y_UNIT_TEST_SUITE(KqpJoin) { AssertTableReads(result, "/Root/Join1_2", 3); } + Y_UNIT_TEST(JoinWithDuplicates) { + // TODO (fix the bug) + return; + TKikimrRunner kikimr; + auto db = kikimr.GetTableClient(); + auto session = db.CreateSession().GetValueSync().GetSession(); + + AssertSuccessResult(session.ExecuteSchemeQuery(R"( + --!syntax_v1 + + CREATE TABLE ObjectParts ( + Hash Uint64, + BucketName Utf8, + ObjectName Utf8, + UploadStartedUsec Uint64, + Id Uint32, + CreatedUsec Uint64, + DataSize Uint64, + DataMd5 Utf8, + DataSourceType String, + DataSource String, + PRIMARY KEY(Hash, BucketName, ObjectName, UploadStartedUsec, Id) + ); + + CREATE TABLE Objects ( + Hash Uint64, + BucketName Utf8, + Name Utf8, + CreatedUsec Uint64, + StorageClass Uint8, + UploadStartedUsec Uint64, + DataSize Uint64, + DataMd5 Utf8, + MetadataType String, + Metadata String, + DataSourceType String, + DataSource String, + PartsCount Uint32, + ACL String, + CreatorId Utf8, + PRIMARY KEY(Hash, BucketName, Name) + ); + )").GetValueSync()); + + auto result = session.ExecuteDataQuery(R"( + --!syntax_v1 + PRAGMA kikimr.UseNewEngine = "true"; + + $bucket_name = "bucket #1"; + $object_name = "mpobject"; + $upload_started_usec = 999; + $parts_count = 5; + + UPSERT INTO Objects (Hash, BucketName, Name, UploadStartedUsec, PartsCount) VALUES + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, $parts_count); + + UPSERT INTO ObjectParts (Hash, BucketName, ObjectName, UploadStartedUsec, Id, DataSize, DataMd5) VALUES + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, 1, 1, "hash-1"), + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, 2, 2, "hash-2"), + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, 3, 3, "hash-3"), + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, 4, 5, "hash-4"), + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec, 5, 8, "hash-5"), + (5775455696462964606, $bucket_name, $object_name, $upload_started_usec + 1, 1, 1, "hash"); + )", TTxControl::BeginTx().CommitTx()).ExtractValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); + + auto params = kikimr.GetTableClient().GetParamsBuilder() + .AddParam("$bucket_name").Utf8("bucket #1").Build() + .AddParam("$object_name").Utf8("mpobject").Build() + .Build(); + + result = session.ExecuteDataQuery(R"( + --!syntax_v1 + PRAGMA kikimr.UseNewEngine = "true"; + + DECLARE $bucket_name AS Utf8; + DECLARE $object_name AS Utf8; + + SELECT ObjectParts.Id, ObjectParts.DataSize, ObjectParts.DataMd5 + FROM ObjectParts + JOIN Objects + ON Objects.Hash = ObjectParts.Hash + AND Objects.BucketName = ObjectParts.BucketName + AND Objects.Name = ObjectParts.ObjectName + AND Objects.UploadStartedUsec = ObjectParts.UploadStartedUsec + WHERE ObjectParts.Hash = Digest::CityHash($bucket_name || $object_name) + AND ObjectParts.BucketName = $bucket_name + AND ObjectParts.ObjectName = $object_name + ORDER BY ObjectParts.Id; + )", TTxControl::BeginTx().CommitTx(), params).ExtractValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); + CompareYson(R"([ + [[1u];[1u];["hash-1"]]; + [[2u];[2u];["hash-2"]]; + [[3u];[3u];["hash-3"]]; + [[4u];[5u];["hash-4"]]; + [[5u];[8u];["hash-5"]] + ])", FormatResultSetYson(result.GetResultSet(0))); + } + Y_UNIT_TEST_NEW_ENGINE(IdxLookupSelf) { TKikimrRunner kikimr(SyntaxV1Settings()); auto db = kikimr.GetTableClient(); |