@@ -54,6 +54,8 @@ public class BigQueryFederationExpressionParserTest
5454 private static final Logger LOGGER = LoggerFactory .getLogger (BigQueryFederationExpressionParserTest .class );
5555 private static final String COLUMN_QUOTE_CHAR = "\" " ;
5656 private static final String CONSTANT_QUOTE_CHAR = "'" ;
57+ private static final String INPUT_ARGUMENT1 = "110" ;
58+ private static final String INPUT_ARGUMENT2 = "120" ;
5759
5860 BlockAllocator blockAllocator ;
5961 ArrowType intType = new ArrowType .Int (32 , true );
@@ -128,6 +130,78 @@ public void testCreateSqlForComplexExpressionContent_UnaryFunction()
128130 assertEquals (negateClause , "(-110)" );
129131 }
130132
133+ @ Test
134+ public void testCreateSqlForComplexExpressionContent_DivideFunction ()
135+ {
136+ FunctionName divideFunction = StandardFunctions .DIVIDE_FUNCTION_NAME .getFunctionName ();
137+ String divClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (divideFunction , intType , ImmutableList .of ("`col1`" , INPUT_ARGUMENT1 ));
138+ assertEquals ("(`col1` / 110)" , divClause );
139+ }
140+
141+ @ Test
142+ public void testCreateSqlForComplexExpressionContent_MulFunction ()
143+ {
144+ FunctionName mulFunction = StandardFunctions .MULTIPLY_FUNCTION_NAME .getFunctionName ();
145+ String mulClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (mulFunction , intType , ImmutableList .of ("`col1`" , INPUT_ARGUMENT1 ));
146+ assertEquals ("(`col1` * 110)" , mulClause );
147+ }
148+
149+ @ Test
150+ public void testCreateSqlForComplexExpressionContent_EqualFunction ()
151+ {
152+ FunctionName equalFunction = StandardFunctions .EQUAL_OPERATOR_FUNCTION_NAME .getFunctionName ();
153+ String equalClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (equalFunction , intType , ImmutableList .of ("`col1`" , INPUT_ARGUMENT1 ));
154+ assertEquals ("(`col1` = 110)" , equalClause );
155+ }
156+
157+ @ Test
158+ public void testCreateSqlForComplexExpressionContent_GreaterEqlFunction ()
159+ {
160+ FunctionName grtEqlFunction = StandardFunctions .GREATER_THAN_OR_EQUAL_OPERATOR_FUNCTION_NAME .getFunctionName ();
161+ String grtEqlClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (grtEqlFunction , intType , ImmutableList .of ("`col1`" , INPUT_ARGUMENT1 ));
162+ assertEquals ("(`col1` >= 110)" , grtEqlClause );
163+ }
164+
165+ @ Test
166+ public void testCreateSqlForComplexExpressionContent_LessEqlFunction ()
167+ {
168+ FunctionName lesEqlFunction = StandardFunctions .LESS_THAN_OR_EQUAL_OPERATOR_FUNCTION_NAME .getFunctionName ();
169+ String lesEqlClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (lesEqlFunction , intType , ImmutableList .of ("`col1`" , INPUT_ARGUMENT1 ));
170+ assertEquals ("(`col1` <= 110)" , lesEqlClause );
171+ }
172+
173+ @ Test
174+ public void testCreateSqlForComplexExpressionContent_LikeFunction ()
175+ {
176+ FunctionName likeFunction = StandardFunctions .LIKE_PATTERN_FUNCTION_NAME .getFunctionName ();
177+ String likeClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (likeFunction , intType , ImmutableList .of (INPUT_ARGUMENT1 , INPUT_ARGUMENT2 ));
178+ assertEquals ("(110 LIKE 120)" , likeClause );
179+ }
180+
181+ @ Test
182+ public void testCreateSqlForComplexExpressionContent_NotFunction ()
183+ {
184+ FunctionName notFunction = StandardFunctions .NOT_FUNCTION_NAME .getFunctionName ();
185+ String notClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (notFunction , intType , ImmutableList .of (INPUT_ARGUMENT1 ));
186+ assertEquals ("( NOT 110)" , notClause );
187+ }
188+
189+ @ Test
190+ public void testCreateSqlForComplexExpressionContent_IsDistinctFunction ()
191+ {
192+ FunctionName isDistFunction = StandardFunctions .IS_DISTINCT_FROM_OPERATOR_FUNCTION_NAME .getFunctionName ();
193+ String isDistClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (isDistFunction , intType , ImmutableList .of (INPUT_ARGUMENT1 , INPUT_ARGUMENT2 ));
194+ assertEquals ("(110 IS DISTINCT FROM 120)" , isDistClause );
195+ }
196+
197+ @ Test
198+ public void testCreateSqlForComplexExpressionContent_NullIfFunction ()
199+ {
200+ FunctionName nullIfFunction = StandardFunctions .NULLIF_FUNCTION_NAME .getFunctionName ();
201+ String nullIfClause = bigQueryExpressionParser .mapFunctionToDataSourceSyntax (nullIfFunction , intType , ImmutableList .of (INPUT_ARGUMENT1 , INPUT_ARGUMENT2 ));
202+ assertEquals ("(NULLIF(110, 120))" , nullIfClause );
203+ }
204+
131205 @ Test (expected = IllegalArgumentException .class )
132206 public void testCreateSqlForComplexExpressionContent_InvalidBinaryInput ()
133207 {
0 commit comments