mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	MINOR: Add support for search index column lineage (#16032)
This commit is contained in:
		
							parent
							
								
									5fe8024708
								
							
						
					
					
						commit
						b14b191416
					
				| @ -11,6 +11,7 @@ import java.util.Set; | |||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
| import org.openmetadata.schema.type.Column; | import org.openmetadata.schema.type.Column; | ||||||
| import org.openmetadata.schema.type.Field; | import org.openmetadata.schema.type.Field; | ||||||
|  | import org.openmetadata.schema.type.SearchIndexField; | ||||||
| import org.openmetadata.schema.type.TagLabel; | import org.openmetadata.schema.type.TagLabel; | ||||||
| import org.openmetadata.service.exception.CatalogExceptionMessage; | import org.openmetadata.service.exception.CatalogExceptionMessage; | ||||||
| import org.openmetadata.service.util.FullyQualifiedName; | import org.openmetadata.service.util.FullyQualifiedName; | ||||||
| @ -73,6 +74,14 @@ public final class ColumnUtil { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   public static void validateSearchIndexFieldFQN(List<SearchIndexField> fields, String fieldFQN) { | ||||||
|  |     boolean exists = findChildren(fields, "getChildren", fieldFQN); | ||||||
|  |     if (!exists) { | ||||||
|  |       throw new IllegalArgumentException( | ||||||
|  |           CatalogExceptionMessage.invalidFieldName("field", fieldFQN)); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   public static Set<String> getAllTags(Column column) { |   public static Set<String> getAllTags(Column column) { | ||||||
|     Set<String> tags = new HashSet<>(); |     Set<String> tags = new HashSet<>(); | ||||||
|     if (!listOrEmpty(column.getTags()).isEmpty()) { |     if (!listOrEmpty(column.getTags()).isEmpty()) { | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ import static org.openmetadata.service.Entity.CONTAINER; | |||||||
| import static org.openmetadata.service.Entity.DASHBOARD; | import static org.openmetadata.service.Entity.DASHBOARD; | ||||||
| import static org.openmetadata.service.Entity.DASHBOARD_DATA_MODEL; | import static org.openmetadata.service.Entity.DASHBOARD_DATA_MODEL; | ||||||
| import static org.openmetadata.service.Entity.MLMODEL; | import static org.openmetadata.service.Entity.MLMODEL; | ||||||
|  | import static org.openmetadata.service.Entity.SEARCH_INDEX; | ||||||
| import static org.openmetadata.service.Entity.TABLE; | import static org.openmetadata.service.Entity.TABLE; | ||||||
| import static org.openmetadata.service.Entity.TOPIC; | import static org.openmetadata.service.Entity.TOPIC; | ||||||
| import static org.openmetadata.service.search.SearchClient.GLOBAL_SEARCH_ALIAS; | import static org.openmetadata.service.search.SearchClient.GLOBAL_SEARCH_ALIAS; | ||||||
| @ -39,6 +40,7 @@ import org.openmetadata.schema.entity.data.Container; | |||||||
| import org.openmetadata.schema.entity.data.Dashboard; | import org.openmetadata.schema.entity.data.Dashboard; | ||||||
| import org.openmetadata.schema.entity.data.DashboardDataModel; | import org.openmetadata.schema.entity.data.DashboardDataModel; | ||||||
| import org.openmetadata.schema.entity.data.MlModel; | import org.openmetadata.schema.entity.data.MlModel; | ||||||
|  | import org.openmetadata.schema.entity.data.SearchIndex; | ||||||
| import org.openmetadata.schema.entity.data.Table; | import org.openmetadata.schema.entity.data.Table; | ||||||
| import org.openmetadata.schema.entity.data.Topic; | import org.openmetadata.schema.entity.data.Topic; | ||||||
| import org.openmetadata.schema.type.ColumnLineage; | import org.openmetadata.schema.type.ColumnLineage; | ||||||
| @ -207,6 +209,11 @@ public class LineageRepository { | |||||||
|             Entity.getEntity(TABLE, entityReference.getId(), "columns", Include.NON_DELETED); |             Entity.getEntity(TABLE, entityReference.getId(), "columns", Include.NON_DELETED); | ||||||
|         ColumnUtil.validateColumnFQN(table.getColumns(), columnFQN); |         ColumnUtil.validateColumnFQN(table.getColumns(), columnFQN); | ||||||
|       } |       } | ||||||
|  |       case SEARCH_INDEX -> { | ||||||
|  |         SearchIndex searchIndex = | ||||||
|  |             Entity.getEntity(SEARCH_INDEX, entityReference.getId(), "fields", Include.NON_DELETED); | ||||||
|  |         ColumnUtil.validateSearchIndexFieldFQN(searchIndex.getFields(), columnFQN); | ||||||
|  |       } | ||||||
|       case TOPIC -> { |       case TOPIC -> { | ||||||
|         Topic topic = |         Topic topic = | ||||||
|             Entity.getEntity(TOPIC, entityReference.getId(), "messageSchema", Include.NON_DELETED); |             Entity.getEntity(TOPIC, entityReference.getId(), "messageSchema", Include.NON_DELETED); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Mayur Singal
						Mayur Singal