| 129 | } |
| 130 | |
| 131 | static ScanNodeTableInfo getNodeTableScanInfo(const LogicalScanNodeTable& scan, |
| 132 | storage::NodeTable* table, const catalog::TableCatalogEntry* tableEntry, |
| 133 | main::ClientContext* clientContext) { |
| 134 | auto tableInfo = ScanNodeTableInfo(table, copyVector(scan.getPropertyPredicates())); |
| 135 | auto binder = Binder(clientContext); |
| 136 | auto expressionBinder = ExpressionBinder(&binder, clientContext); |
| 137 | for (auto& expr : scan.getProperties()) { |
| 138 | auto& property = expr->constCast<PropertyExpression>(); |
| 139 | if (property.hasProperty(tableEntry->getTableID())) { |
| 140 | auto propertyName = property.getPropertyName(); |
| 141 | if (!tableEntry->containsProperty(propertyName) && |
| 142 | tableEntry->containsProperty("data")) { |
| 143 | auto columnCaster = ColumnCaster(LogicalType::JSON()); |
| 144 | columnCaster.setJSONExtract(propertyName); |
| 145 | tableInfo.addColumnInfo(tableEntry->getColumnID("data"), std::move(columnCaster)); |
| 146 | continue; |
| 147 | } |
| 148 | auto& columnType = tableEntry->getProperty(propertyName).getType(); |
| 149 | auto columnCaster = ColumnCaster(columnType.copy()); |
| 150 | if (property.getDataType() != columnType) { |
| 151 | auto columnExpr = std::make_shared<PropertyExpression>(property); |
| 152 | columnExpr->dataType = columnType.copy(); |
| 153 | columnCaster.setCastExpr( |
| 154 | expressionBinder.forceCast(columnExpr, property.getDataType())); |
| 155 | } |
| 156 | tableInfo.addColumnInfo(tableEntry->getColumnID(propertyName), std::move(columnCaster)); |
| 157 | } else { |
| 158 | tableInfo.addColumnInfo(INVALID_COLUMN_ID, ColumnCaster(LogicalType::ANY())); |
| 159 | } |
| 160 | } |
| 161 | return tableInfo; |
| 162 | } |
| 163 | |
| 164 | std::unique_ptr<PhysicalOperator> PlanMapper::mapExtend(const LogicalOperator* logicalOperator) { |
| 165 | auto extend = logicalOperator->constPtrCast<LogicalExtend>(); |
no test coverage detected