1 | /* | |
2 | * | |
3 | * * Copyright OpenSearch Contributors | |
4 | * * SPDX-License-Identifier: Apache-2.0 | |
5 | * | |
6 | */ | |
7 | ||
8 | package org.opensearch.sql.planner.physical.catalog; | |
9 | ||
10 | import com.google.common.annotations.VisibleForTesting; | |
11 | import java.util.Map; | |
12 | import lombok.EqualsAndHashCode; | |
13 | import lombok.RequiredArgsConstructor; | |
14 | import org.opensearch.sql.catalog.CatalogService; | |
15 | import org.opensearch.sql.data.type.ExprType; | |
16 | import org.opensearch.sql.planner.DefaultImplementor; | |
17 | import org.opensearch.sql.planner.logical.LogicalPlan; | |
18 | import org.opensearch.sql.planner.logical.LogicalRelation; | |
19 | import org.opensearch.sql.planner.physical.PhysicalPlan; | |
20 | import org.opensearch.sql.storage.Table; | |
21 | ||
22 | ||
23 | /** | |
24 | * Table implementation to handle show datasources command. | |
25 | * Since catalog information is not tied to any storage engine, this info | |
26 | * is handled via Catalog Table. | |
27 | * | |
28 | */ | |
29 | @RequiredArgsConstructor | |
30 | @EqualsAndHashCode | |
31 | public class CatalogTable implements Table { | |
32 | ||
33 | private final CatalogService catalogService; | |
34 | ||
35 | @Override | |
36 | public Map<String, ExprType> getFieldTypes() { | |
37 |
1
1. getFieldTypes : replaced return value with Collections.emptyMap for org/opensearch/sql/planner/physical/catalog/CatalogTable::getFieldTypes → KILLED |
return CatalogTableSchema.CATALOG_TABLE_SCHEMA.getMapping(); |
38 | } | |
39 | ||
40 | @Override | |
41 | public PhysicalPlan implement(LogicalPlan plan) { | |
42 |
1
1. implement : replaced return value with null for org/opensearch/sql/planner/physical/catalog/CatalogTable::implement → KILLED |
return plan.accept(new CatalogTableDefaultImplementor(catalogService), null); |
43 | } | |
44 | ||
45 | @VisibleForTesting | |
46 | @RequiredArgsConstructor | |
47 | public static class CatalogTableDefaultImplementor | |
48 | extends DefaultImplementor<Object> { | |
49 | ||
50 | private final CatalogService catalogService; | |
51 | ||
52 | @Override | |
53 | public PhysicalPlan visitRelation(LogicalRelation node, Object context) { | |
54 |
1
1. visitRelation : replaced return value with null for org/opensearch/sql/planner/physical/catalog/CatalogTable$CatalogTableDefaultImplementor::visitRelation → KILLED |
return new CatalogTableScan(catalogService); |
55 | } | |
56 | } | |
57 | ||
58 | } | |
Mutations | ||
37 |
1.1 |
|
42 |
1.1 |
|
54 |
1.1 |