bbotella commented on code in PR #226:
URL:
https://github.com/apache/cassandra-analytics/pull/226#discussion_r3955219675
##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraClusterInfo.java:
##########
@@ -289,11 +289,12 @@ protected String getCurrentKeyspaceSchema() throws
Exception
private TokenRangeReplicasResponse getTokenRangesAndReplicaSets()
{
CassandraContext context = getCassandraContext();
+ String quotedKeyspace = maybeQuotedIdentifier(bridge(),
conf.quoteIdentifiers, conf.keyspace);
Review Comment:
nit: change name to maybeQuotedKeyspace?
##########
cassandra-analytics-core/src/test/java/org/apache/cassandra/spark/bulkwriter/cloudstorage/CloudStorageDataTransferApiImplTest.java:
##########
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cassandra.spark.bulkwriter.cloudstorage;
+
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import
o.a.c.sidecar.client.shaded.common.request.data.CreateRestoreJobRequestPayload;
+import
o.a.c.sidecar.client.shaded.common.request.data.UpdateRestoreJobRequestPayload;
+import
o.a.c.sidecar.client.shaded.common.response.data.RestoreJobSummaryResponsePayload;
+import o.a.c.sidecar.client.shaded.client.SidecarClient;
+import org.apache.cassandra.spark.bulkwriter.JobInfo;
+import org.apache.cassandra.spark.data.QualifiedTableName;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+class CloudStorageDataTransferApiImplTest
+{
+ private static final String QUOTED_KEYSPACE = "\"MyKeyspace\"";
+ private static final String QUOTED_TABLE = "\"MyTable\"";
+ private static final UUID JOB_ID = UUID.randomUUID();
+
+ private SidecarClient sidecarClient;
+ private JobInfo jobInfo;
+ private CloudStorageDataTransferApiImpl api;
+
+ @BeforeEach
+ void setup()
+ {
+ sidecarClient = mock(SidecarClient.class);
+ jobInfo = mock(JobInfo.class);
+ when(jobInfo.qualifiedTableName()).thenReturn(new
QualifiedTableName("MyKeyspace", "MyTable", true));
+ when(jobInfo.getRestoreJobId()).thenReturn(JOB_ID);
+ when(jobInfo.getRestoreJobId(null)).thenReturn(JOB_ID);
+ api = new CloudStorageDataTransferApiImpl(jobInfo, sidecarClient,
mock(StorageClient.class), null);
+ }
+
+ @Test
+ void testCreateRestoreJobUsesQuotedIdentifiers() throws Exception
Review Comment:
What do you think about adding quoted identifiers tests to the other
modified APIs?
##########
cassandra-analytics-common/src/main/java/org/apache/cassandra/spark/data/QualifiedTableName.java:
##########
@@ -65,6 +65,14 @@ public String keyspace()
return keyspace;
}
+ /**
+ * @return the keyspace name, quoted with double quotes when {@code
quoteIdentifiers} is set
+ */
+ public String maybeQuotedKeyspace()
Review Comment:
Wondering here if we really need wrappers with the "maybe*" prefix, or we
can just use this as default for keyspace() and table(). What do you think
@yifan-c / @frankgh ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]