Skip to content

Commit

Permalink
support allowDecimalPrecisionLoss
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Zhou <[email protected]>
  • Loading branch information
zhouyuan committed Feb 28, 2024
1 parent 94c8e7e commit bb88e9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ std::unordered_map<std::string, std::string> WholeStageResultIterator::getQueryC
veloxCfg_->get<std::string>(kSessionTimezone, defaultTimezone);
// Adjust timestamp according to the above configured session timezone.
configs[velox::core::QueryConfig::kAdjustTimestampToTimezone] = std::to_string(true);
// To align with Spark's behavior, allow decimal precision loss or not.
configs[velox::core::QueryConfig::kAllowPrecisionLoss] = getConfigValue(confMap_, kAllowPrecisionLoss, "true");
// Align Velox size function with Spark.
configs[velox::core::QueryConfig::kSparkLegacySizeOfNull] = std::to_string(veloxCfg_->get<bool>(kLegacySize, true));

Expand Down
5 changes: 5 additions & 0 deletions ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@

set -exu

<<<<<<< HEAD
VELOX_REPO=https://github.com/oap-project/velox.git
VELOX_BRANCH=2024_02_27
=======
VELOX_REPO=https://github.com/zhouyuan/velox.git
VELOX_BRANCH=wip_decimal_precision_loss
>>>>>>> 43f847d76... support allowDecimalPrecisionLoss
VELOX_HOME=""

#Set on run gluten on HDFS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,6 @@ object ExpressionConverter extends SQLConfHelper with Logging {
replaceWithExpressionTransformerInternal(_, attributeSeq, expressionsMap)),
expr)
case b: BinaryArithmetic if DecimalArithmeticUtil.isDecimalArithmetic(b) =>
// PrecisionLoss=true: velox support / ch not support
// PrecisionLoss=false: velox not support / ch support
// TODO ch support PrecisionLoss=true
if (!BackendsApiManager.getSettings.allowDecimalArithmetic) {
throw new UnsupportedOperationException(
s"Not support ${SQLConf.DECIMAL_OPERATIONS_ALLOW_PREC_LOSS.key} " +
s"${conf.decimalOperationsAllowPrecisionLoss} mode")
}
val rescaleBinary = if (BackendsApiManager.getSettings.rescaleDecimalLiteral) {
DecimalArithmeticUtil.rescaleLiteral(b)
} else {
Expand Down

0 comments on commit bb88e9f

Please sign in to comment.