@@ -137,7 +137,7 @@ Value TransformLiteralToValue(const substrait::Expression_Literal &literal) {
137
137
case PhysicalType::INT128:
138
138
return Value::DECIMAL (substrait_value, substrait_decimal.precision (), substrait_decimal.scale ());
139
139
default :
140
- throw InternalException ( " Not accepted internal type for decimal" );
140
+ throw NotImplementedException ( " Unsupported internal type for decimal: %s " , decimal_type. ToString () );
141
141
}
142
142
}
143
143
case substrait::Expression_Literal::LiteralTypeCase::kBoolean : {
@@ -174,7 +174,8 @@ Value TransformLiteralToValue(const substrait::Expression_Literal &literal) {
174
174
case substrait::Expression_Literal::LiteralTypeCase::kVarChar :
175
175
return {literal.var_char ().value ()};
176
176
default :
177
- throw SyntaxException (" literals of this type number are not implemented: " + to_string (literal.literal_type_case ()));
177
+ throw NotImplementedException (" literals of this type are not implemented: %s" ,
178
+ substrait::Expression_Literal::GetDescriptor ()->FindFieldByNumber (literal.literal_type_case ())->name ());
178
179
}
179
180
}
180
181
@@ -184,7 +185,7 @@ unique_ptr<ParsedExpression> SubstraitToDuckDB::TransformLiteralExpr(const subst
184
185
185
186
unique_ptr<ParsedExpression> SubstraitToDuckDB::TransformSelectionExpr (const substrait::Expression &sexpr) {
186
187
if (!sexpr.selection ().has_direct_reference () || !sexpr.selection ().direct_reference ().has_struct_field ()) {
187
- throw InternalException (" Can only have direct struct references in selections" );
188
+ throw SyntaxException (" Can only have direct struct references in selections" );
188
189
}
189
190
return make_uniq<PositionalReferenceExpression>(sexpr.selection ().direct_reference ().struct_field ().field () + 1 );
190
191
}
@@ -322,7 +323,8 @@ LogicalType SubstraitToDuckDB::SubstraitToDuckType(const substrait::Type &s_type
322
323
case substrait::Type::KindCase::kFp64 :
323
324
return {LogicalTypeId::DOUBLE};
324
325
default :
325
- throw NotImplementedException (" Substrait type not yet supported" );
326
+ throw NotImplementedException (" Substrait type not yet supported: %s" ,
327
+ substrait::Type::GetDescriptor ()->FindFieldByNumber (s_type.kind_case ())->name ());
326
328
}
327
329
}
328
330
@@ -408,13 +410,15 @@ unique_ptr<ParsedExpression> SubstraitToDuckDB::TransformExpr(const substrait::E
408
410
return TransformNested (sexpr, iterator);
409
411
case substrait::Expression::RexTypeCase::kSubquery :
410
412
default :
411
- throw InternalException (" Unsupported expression type " + to_string (sexpr.rex_type_case ()));
413
+ throw NotImplementedException (" Unsupported expression type %s" ,
414
+ substrait::Expression::GetDescriptor ()->FindFieldByNumber (sexpr.rex_type_case ())->name ());
412
415
}
413
416
}
414
417
415
418
string SubstraitToDuckDB::FindFunction (uint64_t id) {
416
419
if (functions_map.find (id) == functions_map.end ()) {
417
- throw InternalException (" Could not find aggregate function " + to_string (id));
420
+ throw NotImplementedException (" Could not find aggregate function %s" ,
421
+ to_string (id));
418
422
}
419
423
return functions_map[id];
420
424
}
@@ -442,7 +446,8 @@ OrderByNode SubstraitToDuckDB::TransformOrder(const substrait::SortField &sordf)
442
446
dnullorder = OrderByNullType::NULLS_LAST;
443
447
break ;
444
448
default :
445
- throw InternalException (" Unsupported ordering " + to_string (sordf.direction ()));
449
+ throw NotImplementedException (" Unsupported ordering %s" ,
450
+ substrait::SortField::GetDescriptor ()->FindFieldByNumber (sordf.direction ())->name ());
446
451
}
447
452
448
453
return {dordertype, dnullorder, TransformExpr (sordf.expr ())};
@@ -472,7 +477,8 @@ shared_ptr<Relation> SubstraitToDuckDB::TransformJoinOp(const substrait::Rel &so
472
477
djointype = JoinType::OUTER;
473
478
break ;
474
479
default :
475
- throw InternalException (" Unsupported join type" );
480
+ throw NotImplementedException (" Unsupported join type: %s" ,
481
+ substrait::JoinRel::GetDescriptor ()->FindFieldByNumber (sjoin.type ())->name ());
476
482
}
477
483
unique_ptr<ParsedExpression> join_condition = TransformExpr (sjoin.expression ());
478
484
return make_shared_ptr<JoinRelation>(TransformOp (sjoin.left ())->Alias (" left" ),
@@ -543,7 +549,8 @@ const substrait::RelCommon* GetCommon(const substrait::Rel &sop) {
543
549
case substrait::Rel::RelTypeCase::kUpdate :
544
550
case substrait::Rel::RelTypeCase::kDdl :
545
551
default :
546
- throw InternalException (" Unsupported relation type " + to_string (sop.rel_type_case ()));
552
+ throw NotImplementedException (" Unsupported relation type %s" ,
553
+ substrait::Rel::GetDescriptor ()->FindFieldByNumber (sop.rel_type_case ())->name ());
547
554
}
548
555
}
549
556
@@ -840,7 +847,8 @@ static SetOperationType TransformSetOperationType(substrait::SetRel_SetOp setop)
840
847
return SetOperationType::INTERSECT;
841
848
}
842
849
default : {
843
- throw NotImplementedException (" SetOperationType transform not implemented for SetRel_SetOp type %d" , setop);
850
+ throw NotImplementedException (" SetOperationType transform not implemented for SetRel_SetOp type %s" ,
851
+ substrait::SetRel::GetDescriptor ()->FindFieldByNumber (setop)->name ());
844
852
}
845
853
}
846
854
}
@@ -903,7 +911,8 @@ shared_ptr<Relation> SubstraitToDuckDB::TransformWriteOp(const substrait::Rel &s
903
911
}
904
912
}
905
913
default :
906
- throw NotImplementedException (" Unsupported write operation " + to_string (swrite.op ()));
914
+ throw NotImplementedException (" Unsupported write operation %s" ,
915
+ substrait::WriteRel::GetDescriptor ()->FindFieldByNumber (swrite.op ())->name ());
907
916
}
908
917
}
909
918
@@ -931,7 +940,8 @@ shared_ptr<Relation> SubstraitToDuckDB::TransformOp(const substrait::Rel &sop,
931
940
case substrait::Rel::RelTypeCase::kWrite :
932
941
return TransformWriteOp (sop);
933
942
default :
934
- throw InternalException (" Unsupported relation type " + to_string (sop.rel_type_case ()));
943
+ throw NotImplementedException (" Unsupported relation type %s" ,
944
+ substrait::Rel::GetDescriptor ()->FindFieldByNumber (sop.rel_type_case ())->name ());
935
945
}
936
946
}
937
947
0 commit comments