File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/query Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,11 @@ public static ColumnName from(String columnName) {
7575 */
7676 public abstract Optional <CqlIdentifier > getCqlIdentifier ();
7777
78+ CqlIdentifier getRequiredCqlIdentifier () {
79+ return getCqlIdentifier ().or (() -> getColumnName ().map (CqlIdentifier ::fromCql ))
80+ .orElseGet (() -> CqlIdentifier .fromCql (toCql ()));
81+ }
82+
7883 /**
7984 * Represent the column name as CQL.
8085 *
Original file line number Diff line number Diff line change @@ -480,6 +480,10 @@ public FunctionCall as(CqlIdentifier alias) {
480480 return new FunctionCall (expression , params , alias );
481481 }
482482
483+ FunctionCall as (ColumnName alias ) {
484+ return new FunctionCall (expression , params , alias .getRequiredCqlIdentifier ());
485+ }
486+
483487 @ Override
484488 public String getExpression () {
485489 return expression ;
@@ -625,7 +629,7 @@ public Selector column() {
625629
626630 @ Override
627631 public Selector ttl () {
628- return FunctionCall .from ("TTL" , ColumnSelector .from (columnName ));
632+ return FunctionCall .from ("TTL" , ColumnSelector .from (columnName )). as ( columnName ) ;
629633 }
630634
631635 @ Override
@@ -657,7 +661,7 @@ public Selector dotProduct() {
657661 @ Override
658662 public Selector using (SimilarityFunction similarityFunction ) {
659663 return FunctionCall .from ("similarity_" + similarityFunction .name ().toLowerCase (Locale .ROOT ), columnName ,
660- vector );
664+ vector ). as ( columnName ) ;
661665 }
662666 };
663667 }
You can’t perform that action at this time.
0 commit comments