@@ -30,8 +30,8 @@ use arrow::datatypes::{
3030} ;
3131use datafusion_common:: types:: NativeType ;
3232use datafusion_common:: {
33- exec_err, internal_err, plan_datafusion_err, plan_err, Diagnostic , Result , Span ,
34- Spans ,
33+ exec_err, internal_err, not_impl_err , plan_datafusion_err, plan_err, Diagnostic ,
34+ Result , Span , Spans ,
3535} ;
3636use itertools:: Itertools ;
3737
@@ -181,13 +181,20 @@ impl<'a> BinaryTypeCoercer<'a> {
181181 )
182182 } )
183183 }
184- AtArrow | ArrowAt | Arrow | LongArrow | HashArrow | HashLongArrow | AtAt | HashMinus |
185- AtQuestion | Question | QuestionAnd | QuestionPipe |IntegerDivide => {
186- // These operators check for whether one array is contained in another or other JSON operations.
187- // The result type is boolean. Signature::comparison defines this signature.
188- array_coercion ( self . lhs , self . rhs ) . map ( Signature :: comparison) . ok_or_else ( || {
184+ AtArrow | ArrowAt => {
185+ // Array contains or search (similar to LIKE) operation
186+ array_coercion ( self . lhs , self . rhs )
187+ . or_else ( || like_coercion ( self . lhs , self . rhs ) ) . map ( Signature :: comparison) . ok_or_else ( || {
188+ plan_datafusion_err ! (
189+ "Cannot infer common argument type for operation {} {} {}" , self . lhs, self . op, self . rhs
190+ )
191+ } )
192+ }
193+ AtAt => {
194+ // text search has similar signature to LIKE
195+ like_coercion ( self . lhs , self . rhs ) . map ( Signature :: comparison) . ok_or_else ( || {
189196 plan_datafusion_err ! (
190- "Cannot infer common array type for operation {} {} {}" , self . lhs, self . op, self . rhs
197+ "Cannot infer common argument type for AtAt operation {} {} {}" , self . lhs, self . op, self . rhs
191198 )
192199 } )
193200 }
@@ -248,6 +255,10 @@ impl<'a> BinaryTypeCoercer<'a> {
248255 "Cannot coerce arithmetic expression {} {} {} to valid types" , self . lhs, self . op, self . rhs
249256 )
250257 }
258+ } ,
259+ IntegerDivide | Arrow | LongArrow | HashArrow | HashLongArrow
260+ | HashMinus | AtQuestion | Question | QuestionAnd | QuestionPipe => {
261+ not_impl_err ! ( "Operator {} is not yet supported" , self . op)
251262 }
252263 } ;
253264 result. map_err ( |err| {
0 commit comments