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 9662b805dd [ASTERIXDB-3140][OTH] Remove references to Write statement
9662b805dd is described below

commit 9662b805dde89603ec96e887ba09dd50da0ad530
Author: Murtadha Hubail <murtadha.hub...@couchbase.com>
AuthorDate: Wed Mar 15 20:17:17 2023 +0300

    [ASTERIXDB-3140][OTH] Remove references to Write statement
    
    - user model changes: no
    - storage format changes: no
    - interface changes: yes
    
    Details:
    
    - Remove all references to the deprecated Write statement.
    
    Change-Id: I262f59439e483760f37c6c4300dc2f937cd969ed
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17429
    Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Ian Maxon <ima...@uci.edu>
    Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
---
 .../asterix/app/translator/QueryTranslator.java    | 20 -------
 .../apache/asterix/lang/common/base/Statement.java |  1 -
 .../lang/common/statement/WriteStatement.java      | 66 ----------------------
 .../lang/common/visitor/FormatPrintVisitor.java    | 11 ----
 .../lang/common/visitor/QueryPrintVisitor.java     | 11 ----
 .../base/AbstractQueryExpressionVisitor.java       |  6 --
 .../lang/common/visitor/base/ILangVisitor.java     |  3 -
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj    | 20 -------
 8 files changed, 138 deletions(-)

diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 8e61c50396..b0e58852f7 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -23,7 +23,6 @@ import static 
org.apache.asterix.common.utils.IdentifierUtil.dataset;
 import static org.apache.asterix.common.utils.IdentifierUtil.dataverse;
 import static 
org.apache.asterix.lang.common.statement.CreateFullTextFilterStatement.FIELD_TYPE_STOPWORDS;
 
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.rmi.RemoteException;
@@ -157,7 +156,6 @@ import org.apache.asterix.lang.common.statement.TypeDecl;
 import org.apache.asterix.lang.common.statement.TypeDropStatement;
 import org.apache.asterix.lang.common.statement.ViewDecl;
 import org.apache.asterix.lang.common.statement.ViewDropStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.common.util.FunctionUtil;
@@ -244,7 +242,6 @@ import 
org.apache.hyracks.algebricks.core.algebra.base.Counter;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression.FunctionKind;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
-import org.apache.hyracks.algebricks.data.IAWriterFactory;
 import org.apache.hyracks.api.client.IClusterInfoCollector;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -252,7 +249,6 @@ import org.apache.hyracks.api.exceptions.IWarningCollector;
 import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.api.exceptions.Warning;
 import org.apache.hyracks.api.io.FileSplit;
-import org.apache.hyracks.api.io.UnmanagedFileSplit;
 import org.apache.hyracks.api.job.JobFlag;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.api.job.JobSpecification;
@@ -510,9 +506,6 @@ public class QueryTranslator extends AbstractLangTranslator 
implements IStatemen
                     case EXTERNAL_DATASET_REFRESH:
                         
handleExternalDatasetRefreshStatement(metadataProvider, stmt, hcc);
                         break;
-                    case WRITE:
-                        //Deprecated.
-                        break;
                     case FUNCTION_DECL:
                         handleDeclareFunctionStatement(metadataProvider, stmt);
                         break;
@@ -575,18 +568,6 @@ public class QueryTranslator extends 
AbstractLangTranslator implements IStatemen
                 varCounter);
     }
 
-    protected Pair<IAWriterFactory, FileSplit> handleWriteStatement(Statement 
stmt)
-            throws InstantiationException, IllegalAccessException, 
ClassNotFoundException {
-        WriteStatement ws = (WriteStatement) stmt;
-        File f = new File(ws.getFileName());
-        FileSplit outputFile = new 
UnmanagedFileSplit(ws.getNcName().getValue(), f.getPath());
-        IAWriterFactory writerFactory = null;
-        if (ws.getWriterClassName() != null) {
-            writerFactory = (IAWriterFactory) 
Class.forName(ws.getWriterClassName()).newInstance();
-        }
-        return new Pair<>(writerFactory, outputFile);
-    }
-
     protected Dataverse handleUseDataverseStatement(MetadataProvider 
metadataProvider, Statement stmt)
             throws Exception {
         DataverseDecl dvd = (DataverseDecl) stmt;
@@ -5252,7 +5233,6 @@ public class QueryTranslator extends 
AbstractLangTranslator implements IStatemen
             case DATAVERSE_DECL:
             case FUNCTION_DECL:
             case SET:
-            case WRITE:
                 return false;
             default:
                 return true;
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Statement.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Statement.java
index 4330c4e8f0..31a9c51007 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Statement.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Statement.java
@@ -81,7 +81,6 @@ public interface Statement extends ILangExpression {
         SET,
         TYPE_DECL,
         TYPE_DROP,
-        WRITE,
         CREATE_INDEX,
         CREATE_DATAVERSE,
         CREATE_VIEW,
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/WriteStatement.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/WriteStatement.java
deleted file mode 100644
index d4c11e4a7c..0000000000
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/WriteStatement.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-package org.apache.asterix.lang.common.statement;
-
-import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.AbstractStatement;
-import org.apache.asterix.lang.common.base.Statement;
-import org.apache.asterix.lang.common.struct.Identifier;
-import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-
-public class WriteStatement extends AbstractStatement {
-
-    private final Identifier ncName;
-    private final String fileName;
-    private final String writerClassName;
-
-    public WriteStatement(Identifier ncName, String fileName, String 
writerClassName) {
-        this.ncName = ncName;
-        this.fileName = fileName;
-        this.writerClassName = writerClassName;
-    }
-
-    public Identifier getNcName() {
-        return ncName;
-    }
-
-    public String getFileName() {
-        return fileName;
-    }
-
-    public String getWriterClassName() {
-        return writerClassName;
-    }
-
-    @Override
-    public Kind getKind() {
-        return Statement.Kind.WRITE;
-    }
-
-    @Override
-    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws 
CompilationException {
-        return visitor.visit(this, arg);
-    }
-
-    @Override
-    public byte getCategory() {
-        return Category.PROCEDURE;
-    }
-
-}
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java
index f42f2f075c..74243989fb 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java
@@ -110,7 +110,6 @@ import 
org.apache.asterix.lang.common.statement.TypeDropStatement;
 import org.apache.asterix.lang.common.statement.UpdateStatement;
 import org.apache.asterix.lang.common.statement.ViewDecl;
 import org.apache.asterix.lang.common.statement.ViewDropStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.OperatorType;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
@@ -509,16 +508,6 @@ public abstract class FormatPrintVisitor implements 
ILangVisitor<Void, Integer>
         return null;
     }
 
-    @Override
-    public Void visit(WriteStatement ws, Integer step) throws 
CompilationException {
-        out.print(skip(step) + "write output to " + ws.getNcName() + ":" + 
revertStringToQuoted(ws.getFileName()));
-        if (ws.getWriterClassName() != null) {
-            out.print(" using " + ws.getWriterClassName());
-        }
-        out.println();
-        return null;
-    }
-
     @Override
     public Void visit(SetStatement ss, Integer step) throws 
CompilationException {
         out.println(skip(step) + "set " + 
revertStringToQuoted(ss.getPropName()) + " "
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
index 79e90a45a4..aa875b445c 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
@@ -60,7 +60,6 @@ import 
org.apache.asterix.lang.common.statement.InternalDetailsDecl;
 import org.apache.asterix.lang.common.statement.Query;
 import org.apache.asterix.lang.common.statement.SetStatement;
 import org.apache.asterix.lang.common.statement.TypeDecl;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 import org.apache.asterix.lang.common.struct.OperatorType;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
 import 
org.apache.asterix.lang.common.visitor.base.AbstractQueryExpressionVisitor;
@@ -419,16 +418,6 @@ public abstract class QueryPrintVisitor extends 
AbstractQueryExpressionVisitor<V
         return null;
     }
 
-    @Override
-    public Void visit(WriteStatement ws, Integer step) throws 
CompilationException {
-        out.print(skip(step) + "WriteOutputTo " + ws.getNcName() + ":" + 
ws.getFileName());
-        if (ws.getWriterClassName() != null) {
-            out.print(" using " + ws.getWriterClassName());
-        }
-        out.println();
-        return null;
-    }
-
     @Override
     public Void visit(SetStatement ss, Integer step) throws 
CompilationException {
         out.println(skip(step) + "Set " + ss.getPropName() + "=" + 
ss.getPropValue());
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/AbstractQueryExpressionVisitor.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/AbstractQueryExpressionVisitor.java
index a060d1ea9a..a7444e9187 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/AbstractQueryExpressionVisitor.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/AbstractQueryExpressionVisitor.java
@@ -68,7 +68,6 @@ import 
org.apache.asterix.lang.common.statement.TypeDropStatement;
 import org.apache.asterix.lang.common.statement.UpdateStatement;
 import org.apache.asterix.lang.common.statement.ViewDecl;
 import org.apache.asterix.lang.common.statement.ViewDropStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 
 public abstract class AbstractQueryExpressionVisitor<R, T> implements 
ILangVisitor<R, T> {
 
@@ -162,11 +161,6 @@ public abstract class AbstractQueryExpressionVisitor<R, T> 
implements ILangVisit
         return null;
     }
 
-    @Override
-    public R visit(WriteStatement ws, T arg) throws CompilationException {
-        return null;
-    }
-
     @Override
     public R visit(CreateDataverseStatement del, T arg) throws 
CompilationException {
         return null;
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/ILangVisitor.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/ILangVisitor.java
index 8fda66e9cd..541567dddd 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/ILangVisitor.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/base/ILangVisitor.java
@@ -86,7 +86,6 @@ import 
org.apache.asterix.lang.common.statement.TypeDropStatement;
 import org.apache.asterix.lang.common.statement.UpdateStatement;
 import org.apache.asterix.lang.common.statement.ViewDecl;
 import org.apache.asterix.lang.common.statement.ViewDropStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 
 public interface ILangVisitor<R, T> {
 
@@ -170,8 +169,6 @@ public interface ILangVisitor<R, T> {
 
     R visit(TypeDropStatement del, T arg) throws CompilationException;
 
-    R visit(WriteStatement ws, T arg) throws CompilationException;
-
     R visit(SetStatement ss, T arg) throws CompilationException;
 
     R visit(DisconnectFeedStatement del, T arg) throws CompilationException;
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index fe82138fa8..3751118cca 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -171,7 +171,6 @@ import 
org.apache.asterix.lang.common.statement.UpdateStatement;
 import org.apache.asterix.lang.common.statement.UpsertStatement;
 import org.apache.asterix.lang.common.statement.ViewDecl;
 import org.apache.asterix.lang.common.statement.ViewDropStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.OperatorType;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
@@ -913,7 +912,6 @@ Statement SingleStatement() throws ParseException:
     | stmt = CreateStatement()
     | stmt = LoadStatement()
     | stmt = DropStatement()
-    | stmt = WriteStatement()
     | stmt = SetStatement()
     | stmt = InsertStatement()
     | stmt = DeleteStatement()
@@ -2662,24 +2660,6 @@ Statement SetStatement() throws ParseException:
     }
 }
 
-Statement WriteStatement() throws ParseException:
-{
-  Token startToken = null;
-  String nodeName = null;
-  String fileName = null;
-  Query query;
-  String writerClass = null;
-  Pair<Identifier,Identifier> nameComponents = null;
-}
-{
-  <WRITE> { startToken = token; } <OUTPUT> <TO> nodeName = Identifier() 
<COLON> fileName = ConstantString()
-    ( <USING> writerClass = ConstantString() )?
-    {
-      WriteStatement stmt = new WriteStatement(new Identifier(nodeName), 
fileName, writerClass);
-      return addSourceLocation(stmt, startToken);
-    }
-}
-
 LoadStatement LoadStatement() throws ParseException:
 {
   Token startToken = null;

Reply via email to