fix issue382
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql
new file mode 100644
index 0000000..d09e16d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql
@@ -0,0 +1,26 @@
+create dataverse SocialNetworkData;
+
+use dataverse SocialNetworkData;
+
+create type EmploymentType as closed {
+organization-name: string,
+start-date: date,
+end-date: date?
+}
+
+create type FacebookUserType as closed {
+id: int32,
+id-copy: int32,
+alias: string,
+name: string,
+user-since: datetime,
+user-since-copy: datetime,
+friend-ids: {{ int32 }},
+employment: [EmploymentType]
+}
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset HandbookUsers(FacebookUserType)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql
new file mode 100644
index 0000000..72f89e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql
@@ -0,0 +1,10 @@
+use dataverse SocialNetworkData;
+
+load dataset FacebookUsers using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/fbu-dml-insert-shuffled.adm"),("format"="adm"));
+
+insert into dataset HandbookUsers (
+for $x in dataset FacebookUsers
+where $x.id < 10307032
+return $x
+)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql
new file mode 100644
index 0000000..4a2f1ff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql
@@ -0,0 +1,3 @@
+use dataverse SocialNetworkData;
+
+count(for $h in dataset HandbookUsers return $h);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm b/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 124df5d..5842563 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -773,6 +773,11 @@
   </test-group>
   <test-group name="dml">
      <test-case FilePath="dml">
+      <compilation-unit name="query-issue382">
+        <output-dir compare="Text">query-issue382</output-dir>
+      </compilation-unit>
+     </test-case>
+     <test-case FilePath="dml">
       <compilation-unit name="query-issue433">
         <output-dir compare="Text">query-issue433</output-dir>
       </compilation-unit>