File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -107,15 +107,12 @@ class DynamoDBQueryCompiler extends QueryCompiler {
107107 }
108108 else if ( whereItem . type === "whereNull" ) {
109109 scanParam . ExpressionAttributeValues [ `:column_${ columnCount } ` ] = null ;
110- let functionName = "attribute_not_exists" ;
111110 if ( whereItem . not ) {
112- filterExpression += `(#column_${ columnCount } <> :column_${ columnCount } ` ;
113- functionName = "attribute_exists" ;
111+ filterExpression += `(#column_${ columnCount } <> :column_${ columnCount } and attribute_exists(#column_${ columnCount } ))` ;
114112 }
115113 else {
116- filterExpression += `(#column_${ columnCount } = :column_${ columnCount } ` ;
114+ filterExpression += `(#column_${ columnCount } = :column_${ columnCount } or attribute_not_exists(#column_ ${ columnCount } )) ` ;
117115 }
118- filterExpression += ` or ${ functionName } (#column_${ columnCount } ))` ;
119116 }
120117 else if ( whereItem . type === "whereBetween" ) {
121118 scanParam . ExpressionAttributeValues [ `:column_${ columnCount } ` ] =
Original file line number Diff line number Diff line change @@ -119,15 +119,11 @@ export class DynamoDBQueryCompiler extends (QueryCompiler as any) {
119119 } else if ( whereItem . type === "whereNull" ) {
120120 scanParam . ExpressionAttributeValues [ `:column_${ columnCount } ` ] = null ;
121121
122- let functionName = "attribute_not_exists" ;
123122 if ( whereItem . not ) {
124- filterExpression += `(#column_${ columnCount } <> :column_${ columnCount } ` ;
125- functionName = "attribute_exists" ;
123+ filterExpression += `(#column_${ columnCount } <> :column_${ columnCount } and attribute_exists(#column_${ columnCount } ))` ;
126124 } else {
127- filterExpression += `(#column_${ columnCount } = :column_${ columnCount } ` ;
125+ filterExpression += `(#column_${ columnCount } = :column_${ columnCount } or attribute_not_exists(#column_ ${ columnCount } )) ` ;
128126 }
129-
130- filterExpression += ` or ${ functionName } (#column_${ columnCount } ))` ;
131127 } else if ( whereItem . type === "whereBetween" ) {
132128 scanParam . ExpressionAttributeValues [ `:column_${ columnCount } ` ] =
133129 whereItem . value [ 0 ] ;
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ describe("when select", () => {
9696 } ,
9797 ProjectionExpression : "#project_0, #project_1" ,
9898 FilterExpression :
99- "(#column_0 <> :column_0 or attribute_exists(#column_0))" ,
99+ "(#column_0 <> :column_0 and attribute_exists(#column_0))" ,
100100 TableName : "test_test_table"
101101 } ,
102102 expect . anything ( )
You can’t perform that action at this time.
0 commit comments