Skip to content

Commit

Permalink
[FLINK-21727][hive] Support DDL in HiveParser
Browse files Browse the repository at this point in the history
  • Loading branch information
lirui-apache committed Mar 12, 2021
1 parent 64f6e18 commit 5c3eccb
Show file tree
Hide file tree
Showing 23 changed files with 5,664 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,27 @@ public static Object invokeMethod(
}
return method.invoke(obj, args);
}

public static Class tryGetClass(String name) {
try {
return Thread.currentThread().getContextClassLoader().loadClass(name);
} catch (ClassNotFoundException e) {
return null;
}
}

public static Method tryGetMethod(Class clz, String name, Class[] argTypes) {
Method res;
try {
res = clz.getDeclaredMethod(name, argTypes);
} catch (NoSuchMethodException e) {
try {
res = clz.getMethod(name, argTypes);
} catch (NoSuchMethodException ex) {
return null;
}
}
res.setAccessible(true);
return res;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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
*
* https://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.flink.table.planner.delegation.hive;

import org.apache.hadoop.hive.ql.parse.ASTNode;

import java.io.Serializable;

/** A desc for CTAS. */
public class CreateTableASDesc implements Serializable {

private static final long serialVersionUID = 1L;

private final HiveParserCreateTableDesc createTableDesc;
private final ASTNode query;

public CreateTableASDesc(HiveParserCreateTableDesc createTableDesc, ASTNode query) {
this.createTableDesc = createTableDesc;
this.query = query;
}

public HiveParserCreateTableDesc getCreateTableDesc() {
return createTableDesc;
}

public ASTNode getQuery() {
return query;
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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
*
* https://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.flink.table.planner.delegation.hive;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/** Desc to represent DROP PARTITIONS. */
public class DropPartitionDesc implements Serializable {

private static final long serialVersionUID = 1L;

private final String dbName;
private final String tableName;
private final List<Map<String, String>> specs;
private final boolean ifExists;

public DropPartitionDesc(
String dbName, String tableName, List<Map<String, String>> specs, boolean ifExists) {
this.dbName = dbName;
this.tableName = tableName;
this.specs = specs;
this.ifExists = ifExists;
}

public String getDbName() {
return dbName;
}

public String getTableName() {
return tableName;
}

public List<Map<String, String>> getSpecs() {
return specs;
}

public boolean ifExists() {
return ifExists;
}
}
Loading

0 comments on commit 5c3eccb

Please sign in to comment.