Skip to content

Commit

Permalink
Implement CassandraType.toString()
Browse files Browse the repository at this point in the history
The class's toString is used in EXPLAIN and was missing since class was
converted not to be enum.
  • Loading branch information
findepi committed Mar 11, 2022
1 parent af86809 commit 50f9cfe
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import static java.lang.Float.floatToRawIntBits;
import static java.lang.Float.intBitsToFloat;
import static java.lang.Math.toIntExact;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;

public class CassandraType
Expand Down Expand Up @@ -682,4 +683,15 @@ public int hashCode()
{
return Objects.hash(kind, trinoType, argumentTypes);
}

@Override
public String toString()
{
String string = format("%s(%s", kind, trinoType);
if (!argumentTypes.isEmpty()) {
string += "; " + argumentTypes;
}
string += ")";
return string;
}
}

0 comments on commit 50f9cfe

Please sign in to comment.