[asterixdb] branch master updated: [NO ISSUE][COMP] Change typed view configuration syntax

2021-08-20 Thread dlych
This is an automated email from the ASF dual-hosted git repository.

dlych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
 new 1f6f24e  [NO ISSUE][COMP] Change typed view configuration syntax
1f6f24e is described below

commit 1f6f24e152b461fc5914885a42759835ca4f0f6b
Author: Dmitry Lychagin 
AuthorDate: Thu Aug 19 21:41:57 2021 -0700

[NO ISSUE][COMP] Change typed view configuration syntax

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Change how typed view configuration options are
  specified in CREATE VIEW statement. Use sequence
  of identifier / value pairs instead of WITH clause
- Update testcases to use the new syntax

Change-Id: I42fa7a5e45dced37857a9c08ebeafa8410d46476
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12906
Tested-by: Jenkins 
Integration-Tests: Jenkins 
Reviewed-by: Dmitry Lychagin 
Reviewed-by: Ali Alsuliman 
---
 .../create-view-3-typed.1.ddl.sqlpp| 20 +-
 .../create-view-5-typed-warn.1.ddl.sqlpp   | 10 ++---
 .../create-view-6-typed-negative.7.ddl.sqlpp   |  8 ++--
 .../test/resources/runtimets/testsuite_sqlpp.xml   |  2 +-
 .../lang/common/statement/CreateViewStatement.java | 15 
 .../apache/asterix/lang/common/util/ViewUtil.java  | 43 ++
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj| 41 -
 7 files changed, 76 insertions(+), 63 deletions(-)

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-3-typed/create-view-3-typed.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-3-typed/create-view-3-typed.1.ddl.sqlpp
index 406e53a..2e1f472 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-3-typed/create-view-3-typed.1.ddl.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-3-typed/create-view-3-typed.1.ddl.sqlpp
@@ -53,20 +53,20 @@ create view v2_ref_type(t2) default null as
   from t1
 ;
 
-/* custom date/time format (with clause) */
+/* custom date/time format  */
 create view v3_datetime_format(
   c_id int32,
   c_datetime datetime, c_date date, c_time time
-) default null with {
-  'datetime':'MM/DD/ hh:mm:ss.nnna',
-  'date':'MM/DD/',
-  'time':'hh:mm:ss.nnna'
-} as t2;
+) default null
+  datetime 'MM/DD/ hh:mm:ss.nnna'
+  date 'MM/DD/'
+  time 'hh:mm:ss.nnna'
+as t2;
 
-/* custom date format (with clause) */
+/* custom date format */
 create view v4_date_format_only(
   c_id int32,
   c_datetime datetime, c_date date, c_time time
-) default null with {
-  'date':'MM/DD/'
-} as t2;
+) default null
+  date 'MM/DD/'
+as t2;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-5-typed-warn/create-view-5-typed-warn.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-5-typed-warn/create-view-5-typed-warn.1.ddl.sqlpp
index 6e90398..d03801e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-5-typed-warn/create-view-5-typed-warn.1.ddl.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-5-typed-warn/create-view-5-typed-warn.1.ddl.sqlpp
@@ -28,8 +28,8 @@ create dataset t1(c_id int32 not unknown) open type primary 
key c_id;
 create view v1_invalid_datetime_format(
   c_id int32,
   c_datetime datetime, c_date date, c_time time
-) default null with {
-  'datetime':'XX.ZZ.11',
-  'date':'XX.ZZ.22',
-  'time':'XX.ZZ.33'
-} as t1;
+) default null
+  datetime 'XX.ZZ.11'
+  date 'XX.ZZ.22'
+  time 'XX.ZZ.33'
+as t1;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-6-typed-negative/create-view-6-typed-negative.7.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-6-typed-negative/create-view-6-typed-negative.7.ddl.sqlpp
index 6197dae..2e01c03 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-6-typed-negative/create-view-6-typed-negative.7.ddl.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/view/create-view-6-typed-negative/create-view-6-typed-negative.7.ddl.sqlpp
@@ -17,15 +17,13 @@
  * under the License.
  */
 
 Negative: invalid with clause
+--- Negative: invalid view parameter clause
 
 drop dataverse test if exists;
 create dataverse test;
 
 create view test.v1(cd date) default null
-with {
-  'date':'-MM-DD',
-  'date-illegal-property-name':'-MM-DD'
-}
+  date '-MM-DD'
+  date_illegal_property_name '-MM-DD'
 as
   select string(current_date()) cd from range(1,2) r;
diff --git 

[asterixdb] branch master updated: [NO ISSUE][REP] Pass NC active partitions from CC

2021-08-20 Thread mhubail
This is an automated email from the ASF dual-hosted git repository.

mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
 new c9a48b9  [NO ISSUE][REP] Pass NC active partitions from CC
c9a48b9 is described below

commit c9a48b94e22384baf5305c55e8f23af7a26bf88b
Author: Murtadha Hubail 
AuthorDate: Thu Aug 19 21:40:29 2021 +0300

[NO ISSUE][REP] Pass NC active partitions from CC

- user model changes: no
- storage format changes: no
- interface changes: yes

Details:

- Pass NC active partitions from CC and set them
  during node bootstrap.
- Move local storage clean up to LocalStorageCleanupTask
  to clean up after all node partitions have been set.
- Maintain last LSN in master flush LSN to account for
  cases where the first LSN received from master is the
  same as the low water mark LSN.
- Reduce replica failure logging at error level.

Change-Id: I3782bb2be61f8a57ac45dd6dd6ae0942e83ddc40
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12903
Integration-Tests: Jenkins 
Reviewed-by: Murtadha Hubail 
Reviewed-by: Ali Alsuliman 
Tested-by: Murtadha Hubail 
---
 .../org/apache/asterix/app/nc/ReplicaManager.java  |  7 ++
 .../app/nc/task/LocalStorageCleanupTask.java   | 13 +++
 .../asterix/app/nc/task/UpdateNodeStatusTask.java  | 26 +++---
 .../app/replication/NcLifecycleCoordinator.java| 14 +---
 .../message/RegistrationTasksResponseMessage.java  |  2 +-
 .../asterix/hyracks/bootstrap/NCApplication.java   | 11 -
 .../context/PrimaryIndexOperationTracker.java  |  2 +-
 .../asterix/common/storage/IReplicaManager.java|  7 ++
 .../asterix/common/storage/IndexCheckpoint.java|  2 +-
 .../asterix/replication/api/PartitionReplica.java  |  6 -
 .../replication/logging/RemoteLogsNotifier.java|  8 ---
 .../management/IndexReplicationManager.java|  3 ++-
 .../management/LogReplicationManager.java  |  8 +--
 .../replication/sync/ReplicaSynchronizer.java  |  6 +++--
 14 files changed, 86 insertions(+), 29 deletions(-)

diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
index 1d901bd..66a69ef 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
@@ -112,10 +112,17 @@ public class ReplicaManager implements IReplicaManager {
 }
 
 @Override
+public synchronized void setActivePartitions(Set 
activePartitions) {
+partitions.clear();
+partitions.addAll(activePartitions);
+}
+
+@Override
 public synchronized void promote(int partition) throws 
HyracksDataException {
 if (partitions.contains(partition)) {
 return;
 }
+LOGGER.warn("promoting partition {}", partition);
 final PersistentLocalResourceRepository localResourceRepository =
 (PersistentLocalResourceRepository) 
appCtx.getLocalResourceRepository();
 localResourceRepository.cleanup(partition);
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalStorageCleanupTask.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalStorageCleanupTask.java
index 5471fb8..a926c66 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalStorageCleanupTask.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalStorageCleanupTask.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.app.nc.task;
 
+import java.util.Set;
+
 import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.asterix.common.api.INcApplicationContext;
 import org.apache.asterix.common.dataflow.DatasetLocalResource;
@@ -41,6 +43,17 @@ public class LocalStorageCleanupTask implements 
INCLifecycleTask {
 INcApplicationContext appContext = (INcApplicationContext) 
cs.getApplicationContext();
 PersistentLocalResourceRepository localResourceRepository =
 (PersistentLocalResourceRepository) 
appContext.getLocalResourceRepository();
+deleteInvalidMetadataIndexes(localResourceRepository);
+final Set nodePartitions = 
appContext.getReplicaManager().getPartitions();
+localResourceRepository.deleteCorruptedResources();
+//TODO optimize this to cleanup all active partitions at once
+for (Integer partition : nodePartitions) {
+localResourceRepository.cleanup(partition);
+}
+}
+
+private void 
deleteInvalidMetadataIndexes(PersistentLocalResourceRepository 
localResourceRepository)
+throws 

[asterixdb] branch master updated: [ASTERIXDB-2952][COMP] Support CROSS JOIN

2021-08-20 Thread mhubail
This is an automated email from the ASF dual-hosted git repository.

mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
 new d3eccd4  [ASTERIXDB-2952][COMP] Support CROSS JOIN
d3eccd4 is described below

commit d3eccd4f3b3e95a71d6e8d1f1f9da12c50b248cd
Author: Dmitry Lychagin 
AuthorDate: Thu Aug 19 12:18:17 2021 -0700

[ASTERIXDB-2952][COMP] Support CROSS JOIN

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Add support for CROSS JOIN
- Add testcases and update documentation

Change-Id: Ib9f7350576592ca2858e46878e0b428855e3f2d2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12904
Integration-Tests: Jenkins 
Tested-by: Jenkins 
Reviewed-by: Dmitry Lychagin 
Reviewed-by: Ali Alsuliman 
---
 .../join/cross-join-01/cross-join-01.1.ddl.sqlpp   | 46 ++
 .../cross-join-01/cross-join-01.2.update.sqlpp | 22 +++
 .../join/cross-join-01/cross-join-01.3.query.sqlpp | 27 +
 .../join/cross-join-01/cross-join-01.4.query.sqlpp | 29 ++
 .../join/cross-join-01/cross-join-01.5.query.sqlpp | 28 +
 .../cross-join-02-negative.1.query.sqlpp   | 26 
 .../results/join/cross-join-01/cross-join-01.3.adm |  1 +
 .../results/join/cross-join-01/cross-join-01.4.adm | 25 
 .../results/join/cross-join-01/cross-join-01.5.adm |  4 ++
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 11 ++
 asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf  |  3 +-
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj| 37 +++--
 12 files changed, 254 insertions(+), 5 deletions(-)

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.1.ddl.sqlpp
new file mode 100644
index 000..dd75e79
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.1.ddl.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.Schema as
+ closed {
+  unique1 : bigint,
+  unique2 : bigint,
+  two : bigint,
+  four : bigint,
+  ten : bigint,
+  twenty : bigint,
+  onePercent : bigint,
+  tenPercent : bigint,
+  twentyPercent : bigint,
+  fiftyPercent : bigint,
+  unique3 : bigint,
+  evenOnePercent : bigint,
+  oddOnePercent : bigint,
+  stringu1 : string,
+  stringu2 : string,
+  string4 : string
+};
+
+create  dataset onektup(Schema) primary key unique2;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.2.update.sqlpp
new file mode 100644
index 000..e5d85fe
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/join/cross-join-01/cross-join-01.2.update.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+load  dataset onektup using localfs 

[asterixdb] branch master updated: [ASTERIXDB-2951][COMP] Support IS DISTINCT FROM operator

2021-08-20 Thread mhubail
This is an automated email from the ASF dual-hosted git repository.

mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
 new 4d5476e  [ASTERIXDB-2951][COMP] Support IS DISTINCT FROM operator
4d5476e is described below

commit 4d5476e6672e6bb749cc2a0de69f4887ff5dce9b
Author: Dmitry Lychagin 
AuthorDate: Wed Aug 18 19:43:22 2021 -0700

[ASTERIXDB-2951][COMP] Support IS DISTINCT FROM operator

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Add support for IS [NOT] DISTINCT FROM comparison operator
- Add testcases and update documentation

Change-Id: Ifad404fa7c613771f60bd12f3aa2bd5fea77ba34
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12884
Integration-Tests: Jenkins 
Tested-by: Jenkins 
Reviewed-by: Dmitry Lychagin 
Reviewed-by: Ali Alsuliman 
---
 .../is_distinct_01/is_distinct_01.1.query.sqlpp| 39 +
 .../is_distinct_01/is_distinct_01.2.query.sqlpp| 42 +
 .../comparison/is_distinct_01/is_distinct_01.1.adm | 81 ++
 .../comparison/is_distinct_01/is_distinct_01.2.adm |  1 +
 .../test/resources/runtimets/testsuite_sqlpp.xml   |  5 ++
 .../asterix-doc/src/main/markdown/sqlpp/2_expr.md  |  4 +-
 .../asterix/lang/common/struct/OperatorType.java   |  4 +-
 .../visitor/OperatorExpressionVisitor.java | 99 ++
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj| 13 ++-
 9 files changed, 268 insertions(+), 20 deletions(-)

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.1.query.sqlpp
new file mode 100644
index 000..c0ed568
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.1.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+from
+  [ int64(2), float(2.0), double(2.5), "str1", "str2", true, false, null, 
missing ] arg1,
+  [ int32(2), double(2.0), float(2.5), "str1", "str2", true, false, null, 
missing ] arg2
+let
+  is_distinct = arg1 is distinct from arg2,
+  is_not_distinct = arg1 is not distinct from arg2
+select
+  case
+when arg1 is missing then "MISSING"
+when arg1 is null then "NULL"
+else arg1
+  end as arg1,
+  case
+when arg2 is missing then "MISSING"
+when arg2 is null then "NULL"
+else arg2
+  end as arg2,
+  is_distinct as `!!==`,
+  is_not_distinct as `==`
+order by is_distinct, arg1, arg2
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.2.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.2.query.sqlpp
new file mode 100644
index 000..fcc1dc2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/is_distinct_01/is_distinct_01.2.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+let
+  x = 2, y = 3
+select
+  /* test expression */
+  x between 1 and 3 is not distinct from x between 0 and 4 as t1,
+  /* expected operator