1- /*
1+ /*
22 * Copyright © 2020 Cask Data, Inc.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -114,7 +114,7 @@ public void testGenerateQueryForMaterializingView_AllOptions() {
114114
115115 @ Test
116116 public void testGenerateQuery_WithFilterOnly () {
117- String expectedQuery = String .format ("select * from %s where %s" ,
117+ String expectedQuery = String .format ("select * from `%s` where %s" ,
118118 TEST_TABLE_SPEC , TEST_FILTER );
119119
120120 String generatedQuery = format .generateQuery (null , null ,
@@ -126,7 +126,7 @@ public void testGenerateQuery_WithFilterOnly() {
126126
127127 @ Test
128128 public void testGenerateQuery_AllOptions () {
129- String expectedQuery = String .format ("select * from %s where %s order by %s limit %s" ,
129+ String expectedQuery = String .format ("select * from `%s` where %s order by %s limit %s" ,
130130 TEST_TABLE_SPEC , TEST_FILTER , TEST_ORDER_BY , TEST_LIMIT );
131131
132132 String generatedQuery = format .generateQuery (null , null ,
@@ -141,7 +141,7 @@ public void testGenerateQuery_TimePartitionWithDates() {
141141 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
142142 when (mockTimePartitioning .getField ()).thenReturn (null );
143143
144- String expectedQuery = String .format ("select * from %s where (%s)" ,
144+ String expectedQuery = String .format ("select * from `%s` where (%s)" ,
145145 TEST_TABLE_SPEC ,
146146 TEST_PARTITION_CONDITION );
147147
@@ -156,7 +156,7 @@ public void testGenerateQuery_TimePartitionWithDates() {
156156 public void testGenerateQuery_TimePartitionRequiredAndFilter () {
157157 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
158158 when (mockTimePartitioning .getField ()).thenReturn (null );
159- String expectedQuery = String .format ("select * from %s where %s and (%s)" ,
159+ String expectedQuery = String .format ("select * from `%s` where %s and (%s)" ,
160160 TEST_TABLE_SPEC , TEST_DEFAULT_TIME_CONDITION , TEST_FILTER );
161161
162162 String generatedQuery = format .generateQuery (null , null ,
@@ -175,7 +175,7 @@ public void testGenerateQuery_TimeUnitPartitionWithDates() {
175175 when (mockFieldList .get (TEST_TIME_UNIT_COL )).thenReturn (mockField );
176176 when (mockField .getType ()).thenReturn (LegacySQLTypeName .DATE );
177177
178- String expectedQuery = String .format ("select * from %s where (%s)" ,
178+ String expectedQuery = String .format ("select * from `%s` where (%s)" ,
179179 TEST_TABLE_SPEC , TEST_TIME_UNIT_PARTITION_CONDITION );
180180
181181 String generatedQuery = format .generateQuery (TEST_FROM_DATE , TEST_TO_DATE , null ,
@@ -190,7 +190,7 @@ public void testGenerateQuery_TimePartitionFilterNotRequiredWithDates() {
190190 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
191191 when (mockTimePartitioning .getField ()).thenReturn (null );
192192
193- String expectedQuery = String .format ("select * from %s where (%s)" ,
193+ String expectedQuery = String .format ("select * from `%s` where (%s)" ,
194194 TEST_TABLE_SPEC ,
195195 TEST_PARTITION_CONDITION );
196196
@@ -212,7 +212,7 @@ public void testGenerateQuery_NoOptions_ShouldReturnNull() {
212212
213213 @ Test
214214 public void testGenerateQuery_WithLimitOnly_ShouldAssertQuery () {
215- String expectedQuery = String .format ("select * from %s limit %s" , TEST_TABLE_SPEC ,
215+ String expectedQuery = String .format ("select * from `%s` limit %s" , TEST_TABLE_SPEC ,
216216 TEST_LIMIT );
217217
218218 String generatedQuery = format .generateQuery (null , null ,
@@ -224,7 +224,7 @@ public void testGenerateQuery_WithLimitOnly_ShouldAssertQuery() {
224224
225225 @ Test
226226 public void testGenerateQuery_WithOrderByOnly_ShouldAssertQuery () {
227- String expectedQuery = String .format ("select * from %s order by %s" , TEST_TABLE_SPEC ,
227+ String expectedQuery = String .format ("select * from `%s` order by %s" , TEST_TABLE_SPEC ,
228228 TEST_ORDER_BY );
229229
230230 String generatedQuery = format .generateQuery (null , null ,
@@ -239,7 +239,7 @@ public void testGenerateQuery_TimePartitionNotRequired_WithDates_ShouldAssertQue
239239 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
240240 when (mockTimePartitioning .getField ()).thenReturn (null );
241241
242- String expectedQuery = String .format ("select * from %s where (%s)" ,
242+ String expectedQuery = String .format ("select * from `%s` where (%s)" ,
243243 TEST_TABLE_SPEC ,
244244 TEST_PARTITION_CONDITION );
245245
@@ -255,7 +255,7 @@ public void testGenerateQuery_TimePartitionRequired_WithFilterOnly_ShouldAssertQ
255255 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
256256 when (mockTimePartitioning .getField ()).thenReturn (null );
257257
258- String expectedQuery = String .format ("select * from %s where %s and (%s)" ,
258+ String expectedQuery = String .format ("select * from `%s` where %s and (%s)" ,
259259 TEST_TABLE_SPEC , TEST_DEFAULT_TIME_CONDITION , TEST_FILTER );
260260
261261 String generatedQuery = format .generateQuery (null , null ,
@@ -270,7 +270,7 @@ public void testGenerateQuery_RangePartitionRequiredAndFilter() {
270270 when (mockTableDefinition .getRangePartitioning ()).thenReturn (mockRangePartitioning );
271271 when (mockRangePartitioning .getField ()).thenReturn ("range_col" );
272272
273- String expectedQuery = String .format ("select * from %s where %s and (%s)" ,
273+ String expectedQuery = String .format ("select * from `%s` where %s and (%s)" ,
274274 TEST_TABLE_SPEC , TEST_DEFAULT_RANGE_CONDITION , TEST_FILTER );
275275
276276 String generatedQuery = format .generateQuery (null , null , TEST_FILTER ,
@@ -285,7 +285,7 @@ public void testGenerateQuery_RangePartitionRequiredWithLimit() {
285285 when (mockTableDefinition .getRangePartitioning ()).thenReturn (mockRangePartitioning );
286286 when (mockRangePartitioning .getField ()).thenReturn ("range_col" );
287287
288- String expectedQuery = String .format ("select * from %s where %s limit %s" ,
288+ String expectedQuery = String .format ("select * from `%s` where %s limit %s" ,
289289 TEST_TABLE_SPEC , TEST_DEFAULT_RANGE_CONDITION , TEST_LIMIT );
290290
291291 String generatedQuery = format .generateQuery (null , null , null ,
@@ -300,7 +300,7 @@ public void testGenerateQuery_TimeUnitPartitionRequiredAndFilter() {
300300 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
301301 when (mockTimePartitioning .getField ()).thenReturn (TEST_TIME_UNIT_COL );
302302
303- String expectedQuery = String .format ("select * from %s where %s and (%s)" ,
303+ String expectedQuery = String .format ("select * from `%s` where %s and (%s)" ,
304304 TEST_TABLE_SPEC , TEST_DEFAULT_TIME_UNIT_CONDITION , TEST_FILTER );
305305
306306 String generatedQuery = format .generateQuery (null , null , TEST_FILTER ,
@@ -315,7 +315,7 @@ public void testGenerateQuery_TimeUnitPartitionRequiredWithLimit() {
315315 when (mockTableDefinition .getTimePartitioning ()).thenReturn (mockTimePartitioning );
316316 when (mockTimePartitioning .getField ()).thenReturn (TEST_TIME_UNIT_COL );
317317
318- String expectedQuery = String .format ("select * from %s where %s limit %s" ,
318+ String expectedQuery = String .format ("select * from `%s` where %s limit %s" ,
319319 TEST_TABLE_SPEC , TEST_DEFAULT_TIME_UNIT_CONDITION , TEST_LIMIT );
320320
321321 String generatedQuery = format .generateQuery (null , null , null ,
0 commit comments