Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
49f665a
PDQ key and permutation sorting
Sep 24, 2022
1444e96
TAS sorting class initial cut
Sep 24, 2022
d0a4c9e
WIP permutatop-capable PDQsort works
Sep 26, 2022
4679acf
WIP Sorting algo changes
Sep 26, 2022
4d9aa56
WIP Trivial ORDER BY works for BIGINT
Sep 28, 2022
39c016c
WIP working on range based sorting
Oct 1, 2022
a5534ac
WIP single-column BIGINT sorting works
Oct 4, 2022
86d8b34
WIP This patch changes ranges repr and implements multiple column sort
Oct 5, 2022
cdce188
WIP Enable concepts and refactor sorting with recursion
Oct 6, 2022
c8b9d45
WIP Sorting handles sorting direction correctly
Oct 10, 2022
e327d38
WIP Enable branchless right partitioning in pdqsort
drrtuy Apr 15, 2023
395f325
Adding LIMIT/OFFSET support
drrtuy Oct 19, 2022
a2416b5
WIP prepare for constnullablestring
drrtuy Apr 2, 2023
145336a
WIP Initial char support patch
Oct 23, 2022
e936dad
WIP adding simple tests for single step sorting
drrtuy Apr 15, 2023
b0e1f67
WIP single step sorting for temporal and char datatypes
drrtuy Apr 2, 2023
0c4e0ff
WIP Decimal sorting support
Nov 2, 2022
d837292
WIP Composite key sorting
Nov 3, 2022
2d026e1
WIP preparations for multi-threaded sort
Nov 9, 2022
0003fb2
WIP parallel sorting intermediate patch
drrtuy Apr 15, 2023
77f02dd
WIP on parallel sort
Nov 16, 2022
2214715
WIP parallel flat sorting works
drrtuy Apr 15, 2023
daf5399
WIP This patch hides template method as a method
drrtuy Apr 2, 2023
7e18981
WIP parallel sorting works. No proper stats calculation yet though
drrtuy Apr 15, 2023
b1fd33a
WIP Parallel factor is now configurable. Stats doesn't work properly
Nov 30, 2022
30bf0c4
WIP lowerBound using permutation vector
Nov 30, 2022
fe29d41
WIP hardcoded lowerbound for 3 threads + logical function basis
Dec 1, 2022
9c07f44
WIP separate and generalise <left, right> calculation
Dec 2, 2022
89007c2
WIP Generalize the calcStats routine
Dec 6, 2022
ae0bc2a
WIP This commit introduces HeapOrderBy the first finalize thread uses
Dec 11, 2022
ba7c846
Revert "This commit fixes U20 linking issue when libwriteengine.so la…
Dec 14, 2022
ec60cf4
WIP HeapOrderBy works with a combination of BIGINT type and ASC order
drrtuy Apr 2, 2023
2e52e57
WIP Trivial heaporderby tests and pqorderby tests
Dec 23, 2022
3dc5bfd
WIP HeapOrderBy ctor works
Dec 31, 2022
4aafe01
WIP HeapOrderBy works for int64
Jan 1, 2023
2b69152
WIP KeyType now handles VARCHAR
Jan 4, 2023
06df51b
WIP Long strings less works
Jan 6, 2023
3b3c832
WIP The tests now covers INT types
Jan 7, 2023
c755377
WIP Int commit
Jan 12, 2023
256bcb2
WIP Uints tests are green
Jan 16, 2023
ba9e7de
WIP Initial float Key encoder.
Jan 18, 2023
0d7e3a1
WIP Float/Double tests are now a template test
Jan 19, 2023
bcb8b2b
WIP double encoding works
Jan 21, 2023
dd7af4f
WIP WideDecimal tests first cut
Jan 21, 2023
23cd9c9
WIP Keys test for wide decimal
Jan 25, 2023
dda0f79
WIP Fixed decimal sizes in KeyType ctor + removed extra output
Jan 26, 2023
db19141
WIP Replaced KeyType::less with more sophisticated version.
Jan 28, 2023
142c571
WIP HeapOderBy is now aligned with PDQOrderBy about sorting direction
Jan 29, 2023
df2a68a
WIP HeapOrderBy handles threads w/o permutes and parallization factor…
Jan 31, 2023
920fd92
WIP Disable PQ order by UTs
Feb 9, 2023
86b0b48
WIP Initial effective metric
drrtuy Apr 9, 2023
3f1aff8
WIP this introduces an efficient M3 metric
drrtuy Apr 13, 2023
be7bd92
WIP disable a strange ASAN warning about smart pointers
drrtuy Apr 15, 2023
bb3e436
WIP rebase fixes
drrtuy Apr 15, 2023
61408ea
WIP fixed sigabrt when number of threads is not a power of 2
drrtuy Apr 17, 2023
e10e820
WIP minor changes
drrtuy Apr 30, 2023
74a708d
WIP take a correct column offset from RG, skip NULL values picking pi…
drrtuy May 7, 2023
17108eb
chore(): rebase leftover fixes.
drrtuy Sep 21, 2025
1aa8393
fix(OB,joblist): introduce a bypass if there is only one RGData.
drrtuy Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions datatypes/mcs_datatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
MA 02110-1301, USA. */
#pragma once

#include <cstdint>
#include <sstream>
#include <boost/any.hpp>
#include "exceptclasses.h"
Expand Down Expand Up @@ -180,6 +181,14 @@ class SystemCatalog
LONGDOUBLE, /* @bug3241, dev and variance calculation only */
STRINT, /* @bug3532, string as int for fast comparison */
UNDEFINED, /*!< Undefined - used in UDAF API */
// CHAR_1BYTE,
// CHAR_2BYTES,
// CHAR_4BYTES,
// CHAR_8BYTES,
// VARCHAR_1BYTE,
// VARCHAR_2BYTES,
// VARCHAR_4BYTES,
// VARCHAR_8BYTES,
};

// XXX: It is assumed here that ALL TYPES have width, scale and precision.
Expand Down Expand Up @@ -555,6 +564,114 @@ inline bool hasUnderlyingWideDecimalForSumAndAvg(datatypes::SystemCatalog::ColDa
return datatypes::isSignedInteger(type) || datatypes::isUnsigned(type);
}

template <SystemCatalog::ColDataType ColType, typename T = void>
struct _ColDataTypeToIntegralType
{
typedef T type;
};

template <SystemCatalog::ColDataType ColType>
struct ColDataTypeToIntegralType : _ColDataTypeToIntegralType<ColType>
{
};
// Bit types
template <>
struct ColDataTypeToIntegralType<SystemCatalog::BIT> : _ColDataTypeToIntegralType<SystemCatalog::BIT, int8_t>
{
};
// Integer types
template <>
struct ColDataTypeToIntegralType<SystemCatalog::TINYINT>
: _ColDataTypeToIntegralType<SystemCatalog::TINYINT, int8_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::SMALLINT>
: _ColDataTypeToIntegralType<SystemCatalog::SMALLINT, int16_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::MEDINT>
: _ColDataTypeToIntegralType<SystemCatalog::MEDINT, int32_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::INT> : _ColDataTypeToIntegralType<SystemCatalog::INT, int32_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::BIGINT>
: _ColDataTypeToIntegralType<SystemCatalog::BIGINT, int64_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UTINYINT>
: _ColDataTypeToIntegralType<SystemCatalog::UTINYINT, uint8_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::USMALLINT>
: _ColDataTypeToIntegralType<SystemCatalog::USMALLINT, uint16_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UMEDINT>
: _ColDataTypeToIntegralType<SystemCatalog::UMEDINT, uint32_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UINT>
: _ColDataTypeToIntegralType<SystemCatalog::UINT, uint32_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UBIGINT>
: _ColDataTypeToIntegralType<SystemCatalog::UBIGINT, uint64_t>
{
};
// Float types
template <>
struct ColDataTypeToIntegralType<SystemCatalog::FLOAT>
: _ColDataTypeToIntegralType<SystemCatalog::FLOAT, float>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::DOUBLE>
: _ColDataTypeToIntegralType<SystemCatalog::DOUBLE, double>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UFLOAT>
: _ColDataTypeToIntegralType<SystemCatalog::UFLOAT, float>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::UDOUBLE>
: _ColDataTypeToIntegralType<SystemCatalog::UDOUBLE, double>
{
};
// Date,time types
template <>
struct ColDataTypeToIntegralType<SystemCatalog::DATE>
: _ColDataTypeToIntegralType<SystemCatalog::DATE, uint32_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::DATETIME>
: _ColDataTypeToIntegralType<SystemCatalog::DATETIME, uint64_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::TIMESTAMP>
: _ColDataTypeToIntegralType<SystemCatalog::TIMESTAMP, uint64_t>
{
};
template <>
struct ColDataTypeToIntegralType<SystemCatalog::TIME>
: _ColDataTypeToIntegralType<SystemCatalog::TIME, uint64_t>
{
};

} // end of namespace datatypes

namespace datatypes
Expand Down
6 changes: 4 additions & 2 deletions datatypes/mcs_decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ constexpr uint128_t operator""_xxl()

namespace datatypes
{
constexpr uint32_t MAXDECIMALWIDTH = 16U;
constexpr uint32_t DECIMAL128WIDTH = 16U;
constexpr uint32_t MAXDECIMALWIDTH = DECIMAL128WIDTH;
constexpr uint8_t INT64MAXPRECISION = 18U;
constexpr uint8_t INT128MAXPRECISION = 38U;
constexpr uint32_t MAXLEGACYWIDTH = 8U;
constexpr uint32_t DECIMAL64WIDTH = 8U;
constexpr uint32_t MAXLEGACYWIDTH = DECIMAL64WIDTH;
constexpr uint8_t MAXSCALEINC4AVG = 4U;

const uint64_t mcs_pow_10[20] = {
Expand Down
5 changes: 4 additions & 1 deletion datatypes/mcs_int128.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class TSInt128
{
return s128Value == static_cast<int128_t>(x);
}
inline bool operator==(const TSInt128 x) const
{
return s128Value == x.s128Value;
}

inline operator double() const
{
Expand Down Expand Up @@ -321,4 +325,3 @@ class TSInt128
}; // end of class

} // end of namespace datatypes

2 changes: 2 additions & 0 deletions dbcon/joblist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ set(joblist_LIB_SRCS
jobstepassociation.cpp
lbidlist.cpp
limitedorderby.cpp
pdqorderby.cpp
heaporderby.cpp
passthrucommand-jl.cpp
passthrustep.cpp
pcolscan.cpp
Expand Down
Loading