Skip to content

Commit 1d026c6

Browse files
committed
fix(parquet): Fix inserting decimal type values precision and scale
1 parent c526fa0 commit 1d026c6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ RowTypePtr toRowType(
7575
return ROW(std::move(names), std::move(types));
7676
}
7777

78+
RowTypePtr toRowType(
79+
const std::vector<protocol::VariableReferenceExpression>& variables,
80+
const std::vector<TypePtr>& types) {
81+
// VELOX_CHECK_EQ(types.size(), variables.size());
82+
std::vector<std::string> names;
83+
names.reserve(variables.size());
84+
for (const auto& variable : variables) {
85+
names.emplace_back(variable.name);
86+
}
87+
88+
return ROW(std::move(names), std::move(types));
89+
}
90+
7891
std::shared_ptr<connector::ColumnHandle> toColumnHandle(
7992
const protocol::ColumnHandle* column,
8093
const TypeParser& typeParser) {
@@ -1526,9 +1539,10 @@ VeloxQueryPlanConverterBase::toVeloxQueryPlan(
15261539
sourceVeloxPlan,
15271540
tableWriteInfo,
15281541
taskId);
1542+
auto tableTypes = insertTableHandle->connectorInsertTableHandle()->getColumnHandleDataTypes();
15291543
return std::make_shared<core::TableWriteNode>(
15301544
node->id,
1531-
toRowType(node->columns, typeParser_),
1545+
toRowType(node->columns, tableTypes),
15321546
node->columnNames,
15331547
columnStatsSpec,
15341548
std::move(insertTableHandle),

0 commit comments

Comments
 (0)