MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / matchColumnExpression

Function matchColumnExpression

src/binder/bind/copy/bind_copy_from.cpp:119–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 std::vector<LogicalType>& columnTypes);
118
119static std::pair<ColumnEvaluateType, std::shared_ptr<Expression>> matchColumnExpression(
120 const expression_vector& columns, const PropertyDefinition& property,
121 ExpressionBinder& expressionBinder) {
122 for (auto& column : columns) {
123 if (property.getName() == column->toString()) {
124 if (column->dataType == property.getType()) {
125 return {ColumnEvaluateType::REFERENCE, column};
126 } else {
127 return {ColumnEvaluateType::CAST,
128 expressionBinder.forceCast(column, property.getType())};
129 }
130 }
131 }
132 return {ColumnEvaluateType::DEFAULT, expressionBinder.bindExpression(*property.defaultExpr)};
133}
134
135BoundCopyFromInfo Binder::bindCopyNodeFromInfo(std::string tableName,
136 const std::vector<PropertyDefinition>& properties, const BaseScanSource* source,

Callers 2

bindCopyNodeFromInfoMethod · 0.85
bindCopyRelFromInfoMethod · 0.85

Calls 5

forceCastMethod · 0.80
bindExpressionMethod · 0.80
getNameMethod · 0.45
toStringMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected