使用 AWS DMS 加载数据时如何修剪列

问题描述

我必须使用 AWS DMS 迁移表。在加载时,我必须修剪源表中的列并将其加载到目标。我在 AWS DMS 中找不到任何修剪转换规则。如何实现?

解决方法

您可以执行 public class Ai { public static final Ai ai = new Ai(); private static int maxY = 8; private static int maxX = 7; private static int minY = 1; private static int minX = 0; private static ArrayList<Entity> whiteFigures; private static ArrayList<Entity> blackFigures; private static ArrayList<Move> moves; public void processMoves() { moves = new ArrayList<Move>(); resetLists(); for (Entity e : blackFigures) { moves.addAll(calcMoves(e.getFigure(),blackFigures,whiteFigures)); } System.out.println(moves.size()); //removeCheckMoves(); System.out.println(moves.size()); executeMove(moves.get((int) (Math.random() * moves.size()))); resetLists(); Schach.turn = true; } private void removeCheckMoves() { Figure king = null; for (Entity e : blackFigures) { if (e.getFigure().type == Figure.king) { king = e.getFigure(); break; } } ArrayList<Move> legalMoves = new ArrayList<Move>(); for (Move m : moves) { resetLists(); executeMove(m); if(!isLegal(king)) { legalMoves.add(m); } } moves = legalMoves; } private boolean isLegal(Figure king) { boolean check = false; for (Entity w : whiteFigures) { for (Move move : Utils.calcMoves(w.getFigure(),whiteFigures,blackFigures)) { if (Utils.numToPos(move.to).x == king.x && Utils.numToPos(move.to).y == king.y) { check = true; break; } } if(check) break; } return check; } private void executeMove(Move m) { for (Entity e : blackFigures) { if (e.getFigure().x == Utils.numToPos(m.from).x && e.getFigure().y == Utils.numToPos(m.from).y) { e.getFigure().x = Utils.numToPos(m.to).x; e.getFigure().y = Utils.numToPos(m.to).y; e.gotoSquare(Utils.posToNum(e.getFigure()) - 8); for (Entity w : whiteFigures) { if (w.getFigure().x == e.getFigure().x && w.getFigure().y == e.getFigure().y) { whiteFigures.remove(w); break; } } break; } } } private void resetLists() { whiteFigures = new ArrayList<Entity>(); whiteFigures.clear(); whiteFigures.addAll(Schach.whiteFigures); blackFigures = new ArrayList<Entity>(); blackFigures.clear(); blackFigures.addAll(Schach.blackFigures); } //calcMoves function (works fine no reference here for sure) } remove-prefix 作为修剪数据的方法吗? Guide on how to do that here.

或者,您可以在每次向目标位置添加新数据时触发 Lambda 进行修剪。