MCPcopy Create free account
hub / github.com/apache/calcite / path

Method path

core/src/main/java/org/apache/calcite/schema/Schemas.java:560–585  ·  view source on GitHub ↗

Creates a path with a given list of names starting from a given root schema.

(CalciteSchema rootSchema, Iterable<String> names)

Source from the content-addressed store, hash-verified

558 /** Creates a path with a given list of names starting from a given root
559 * schema. */
560 public static Path path(CalciteSchema rootSchema, Iterable<String> names) {
561 final ImmutableList.Builder<Pair<String, Schema>> builder =
562 ImmutableList.builder();
563 Schema schema = rootSchema.plus();
564 final Iterator<String> iterator = names.iterator();
565 if (!iterator.hasNext()) {
566 return PathImpl.EMPTY;
567 }
568 if (!rootSchema.name.isEmpty()) {
569 // If path starts with the name of the root schema, ignore the first step
570 // in the path.
571 checkState(rootSchema.name.equals(iterator.next()));
572 }
573 for (;;) {
574 final String name = iterator.next();
575 builder.add(Pair.of(name, schema));
576 if (!iterator.hasNext()) {
577 return path(builder.build());
578 }
579 Schema next = schema.subSchemas().get(name);
580 if (next == null) {
581 throw new IllegalArgumentException("schema " + name + " is not found in " + schema);
582 }
583 schema = next;
584 }
585 }
586
587 public static Path path(Iterable<? extends Map.Entry<String, Schema>> list) {
588 return new PathImpl(ImmutablePairList.copyOf(list));

Callers 4

testSchemaPathMethod · 0.95
modifiableViewTableMethod · 0.95
modifiableViewTableMethod · 0.95
getTablePathMethod · 0.95

Calls 15

ofMethod · 0.95
subSchemasMethod · 0.95
copyOfMethod · 0.95
ofMethod · 0.95
getParentSchemaMethod · 0.95
getNameMethod · 0.95
builderMethod · 0.65
plusMethod · 0.65
iteratorMethod · 0.65
equalsMethod · 0.65
addMethod · 0.65
buildMethod · 0.65

Tested by 3

testSchemaPathMethod · 0.76
modifiableViewTableMethod · 0.76
getTablePathMethod · 0.76