Skip to content

Commit

Permalink
Updates usages of Collection to List in partiql-spi
Browse files Browse the repository at this point in the history
  • Loading branch information
johnedquinn committed Dec 9, 2024
1 parent aa2a6f2 commit 8d9ded8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TestCatalog private constructor(
for (part in name) {
curr = curr.get(Identifier.delimited(part).first()) ?: break
}
return null
return curr.table
}

override fun resolveTable(session: Session, identifier: Identifier): Name? {
Expand Down
22 changes: 11 additions & 11 deletions partiql-spi/api/partiql-spi.api
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public final class org/partiql/spi/catalog/Identifier : java/lang/Iterable, kotl
public final fun append (Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Identifier;
public final fun append ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier;
public static final fun delimited (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public static final fun delimited (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public static final fun delimited (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public static final fun delimited ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public fun equals (Ljava/lang/Object;)Z
public fun forEach (Ljava/util/function/Consumer;)V
Expand All @@ -136,23 +136,23 @@ public final class org/partiql/spi/catalog/Identifier : java/lang/Iterable, kotl
public fun iterator ()Ljava/util/Iterator;
public final fun matches (Ljava/lang/String;Z)Z
public static synthetic fun matches$default (Lorg/partiql/spi/catalog/Identifier;Ljava/lang/String;ZILjava/lang/Object;)Z
public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public static final fun of ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier;
public static final fun regular (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public static final fun regular (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public static final fun regular (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public static final fun regular ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public fun spliterator ()Ljava/util/Spliterator;
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/spi/catalog/Identifier$Companion {
public final fun delimited (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public final fun delimited (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public final fun delimited (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public final fun delimited ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public final fun of ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier;
public final fun regular (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
public final fun regular (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier;
public final fun regular (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier;
public final fun regular ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier;
}

Expand Down Expand Up @@ -184,14 +184,14 @@ public final class org/partiql/spi/catalog/Name : java/lang/Iterable, kotlin/jvm
public final fun hasNamespace ()Z
public fun hashCode ()I
public fun iterator ()Ljava/util/Iterator;
public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Name;
public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Name;
public static final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Name;
public fun spliterator ()Ljava/util/Spliterator;
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/spi/catalog/Name$Companion {
public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Name;
public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Name;
public final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Name;
}

Expand All @@ -208,15 +208,15 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli
public fun hashCode ()I
public final fun isEmpty ()Z
public fun iterator ()Ljava/util/Iterator;
public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Namespace;
public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Namespace;
public static final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace;
public fun spliterator ()Ljava/util/Spliterator;
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/spi/catalog/Namespace$Companion {
public final fun empty ()Lorg/partiql/spi/catalog/Namespace;
public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Namespace;
public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Namespace;
public final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace;
}

Expand Down Expand Up @@ -255,7 +255,7 @@ public final class org/partiql/spi/catalog/Session$Builder {
public final fun catalog (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun catalogs ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun identity (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun namespace (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun namespace (Ljava/util/List;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun namespace ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder;
public final fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Identifier private constructor(
public fun hasQualifier(): Boolean = qualifier.isNotEmpty()

/**
* Returns a collection of the identifier parts.
* Returns an ordered collection of the identifier parts.
*/
public fun getParts(): List<Part> {
return listOf(*qualifier) + identifier
Expand Down Expand Up @@ -195,7 +195,7 @@ public class Identifier private constructor(
public fun regular(vararg parts: String): Identifier = regular(parts.toList())

@JvmStatic
public fun regular(parts: Collection<String>): Identifier {
public fun regular(parts: List<String>): Identifier {
if (parts.isEmpty()) {
error("Cannot create an identifier with no parts")
}
Expand All @@ -211,7 +211,7 @@ public class Identifier private constructor(
public fun delimited(vararg parts: String): Identifier = delimited(parts.toList())

@JvmStatic
public fun delimited(parts: Collection<String>): Identifier {
public fun delimited(parts: List<String>): Identifier {
if (parts.isEmpty()) {
error("Cannot create an identifier with no parts")
}
Expand All @@ -224,7 +224,7 @@ public class Identifier private constructor(
public fun of(vararg parts: Part): Identifier = of(parts.toList())

@JvmStatic
public fun of(parts: Collection<Part>): Identifier {
public fun of(parts: List<Part>): Identifier {
if (parts.isEmpty()) {
error("Cannot create an identifier with no parts")
}
Expand Down
4 changes: 2 additions & 2 deletions partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Name.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public class Name(
public fun of(vararg names: String): Name = of(names.toList())

/**
* Construct a name from a collection of strings.
* Construct a name from an ordered collection of strings.
*/
@JvmStatic
public fun of(names: Collection<String>): Name {
public fun of(names: List<String>): Name {
assert(names.size > 0) { "Cannot create an empty name" }
val namespace = Namespace.of(names.take(names.size - 1))
val name = names.last()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class Namespace private constructor(
}

@JvmStatic
public fun of(levels: Collection<String>): Namespace {
public fun of(levels: List<String>): Namespace {
if (levels.isEmpty()) {
return empty()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public interface Session {
return this
}

public fun namespace(levels: Collection<String>): Builder {
public fun namespace(levels: List<String>): Builder {
this.namespace = Namespace.of(levels)
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ internal class StandardCatalog(
*/
override fun resolveTable(session: Session, identifier: Identifier): Name? {
// TODO memory connector does not handle qualified identifiers and longest match
if (identifier.hasQualifier()) {
return null
}
val first = identifier.first()
for ((name, _) in tables) {
val str = name.getName() // only use single identifiers for now
Expand Down

0 comments on commit 8d9ded8

Please sign in to comment.