Skip to content

CNDB-14199: Expose methods containsDateRangeTypeColumn #1914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/java/org/apache/cassandra/cql3/CQL3Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ default String toSchemaString()
return toString(false, true);
}

public enum Native implements CQL3Type
enum Native implements CQL3Type
{
ASCII (AsciiType.instance),
BIGINT (LongType.instance),
Expand Down Expand Up @@ -393,7 +393,7 @@ public String toString()

class UserDefined implements CQL3Type
{
// Keeping this separatly from type just to simplify toString()
// Keeping this separately from type just to simplify toString()
private final String name;
private final UserType type;

Expand Down Expand Up @@ -608,7 +608,7 @@ public String toString()
}
}

public static class Vector implements CQL3Type
class Vector implements CQL3Type
{
private final VectorType<?> type;

Expand Down Expand Up @@ -701,6 +701,11 @@ public boolean isCounter()
return false;
}

public boolean isDateRange()
{
return false;
}

public boolean isUDT()
{
return false;
Expand Down Expand Up @@ -916,6 +921,13 @@ public void forEachUserType(Consumer<UTName> userTypeNameConsumer)
// no-op
}

@Override
public boolean isDateRange()
{
return "DateRangeType".equals(className) ||
"org.apache.cassandra.db.marshal.DateRangeType".equals(className);
}

@Override
public String toString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public Keyspaces apply(Keyspaces schema)
return schema.withAddedOrUpdated(apply(keyspace, table));
}

public boolean containsDateRangeTypeColumn()
{
// Classes that need this method exposed have to override it
return false;
}

public ResultMessage execute(QueryState state, boolean locally)
{
return super.execute(state, locally);
Expand Down Expand Up @@ -264,6 +270,18 @@ private void addColumn(KeyspaceMetadata keyspace,
}
}
}

@Override
public boolean containsDateRangeTypeColumn()
{
for (AddColumns.Column column : newColumns)
{
if (column.type.isDateRange())
return true;
}

return false;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ public boolean isCompactStorage()
return useCompactStorage;
}

public boolean containsDateRangeTypeColumn()
{
for (CQL3Type.Raw columnType : rawColumns.values())
{
if (columnType.isDateRange())
return true;
}

return false;
}

@Override
public void validate(QueryState state)
{
Expand Down
Loading