ovr commented on code in PR #2196:
URL: https://github.com/apache/arrow-datafusion/pull/2196#discussion_r888151016


##########
datafusion/expr/src/field_util.rs:
##########
@@ -28,14 +28,7 @@ use datafusion_common::{DataFusionError, Result, 
ScalarValue};
 pub fn get_indexed_field(data_type: &DataType, key: &ScalarValue) -> 
Result<Field> {
     match (data_type, key) {
         (DataType::List(lt), ScalarValue::Int64(Some(i))) => {
-            if *i < 0 {
-                Err(DataFusionError::Plan(format!(
-                    "List based indexed access requires a positive int, was 
{0}",
-                    i
-                )))
-            } else {
-                Ok(Field::new(&i.to_string(), lt.data_type().clone(), false))
-            }
+            Ok(Field::new(&i.to_string(), lt.data_type().clone(), true))

Review Comment:
   I've removed the check for negative integers to be compatible with 
PostgreSQL.
   <img width="822" alt="image" 
src="https://user-images.githubusercontent.com/572096/171677500-8eaa9933-9b2b-48e4-b0c9-17a6f21e29e0.png";>



##########
datafusion/expr/src/field_util.rs:
##########
@@ -28,14 +28,7 @@ use datafusion_common::{DataFusionError, Result, 
ScalarValue};
 pub fn get_indexed_field(data_type: &DataType, key: &ScalarValue) -> 
Result<Field> {
     match (data_type, key) {
         (DataType::List(lt), ScalarValue::Int64(Some(i))) => {
-            if *i < 0 {
-                Err(DataFusionError::Plan(format!(
-                    "List based indexed access requires a positive int, was 
{0}",
-                    i
-                )))
-            } else {
-                Ok(Field::new(&i.to_string(), lt.data_type().clone(), false))
-            }
+            Ok(Field::new(&i.to_string(), lt.data_type().clone(), true))

Review Comment:
   I've removed the check for negative integers to be compatible with 
PostgreSQL.
   
   <img width="822" alt="image" 
src="https://user-images.githubusercontent.com/572096/171677500-8eaa9933-9b2b-48e4-b0c9-17a6f21e29e0.png";>



-- 
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]

Reply via email to